ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-per-player.ext
(Generate patch)

Comparing deliantra/server/ext/map-per-player.ext (file contents):
Revision 1.1 by root, Sat Jan 13 23:06:13 2007 UTC vs.
Revision 1.5 by elmex, Thu Jan 18 15:12:43 2007 UTC

1#! perl # MANDATORY 1#! perl # MANDATORY
2 2
3cf::map->register (qr{^~[^/]+/}); 3cf::map->register (qr{^~([^/]+)(/.*)});
4
5sub decay_objects {
6 # do nothing on per player maps at the moment
7 # as the lone town apartment is broooken
8}
4 9
5sub init { 10sub init {
6 my ($self) = @_; 11 my ($self) = @_;
7 12
8 $self->{user} = $1; 13 $self->{user} = $1;
14 $self->{orig_path} = $2;
15 $self->{deny_reset} = 1; #d# for now
9} 16}
10 17
11sub as_string { 18sub thawer_merge {
19 # we have to keep some variables in memory intact
20 local $_[0]{user};
21 local $_[0]{orig_path};
22 local $_[0]{deny_reset};
23
24 $_[0]->SUPER::thawer_merge ($_[1]);
25}
26
27sub load_path {
12 my ($self) = @_; 28 my ($self) = @_;
13 29
14 "~$self->{user}$self->{path}" 30 sprintf "%s/%s/%s", cf::datadir, cf::mapdir, $self->{orig_path}
15} 31}
16 32
17sub save_path { 33sub save_path {
18 my ($self) = @_; 34 my ($self) = @_;
19 35
36 (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g;
20 sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $self->_escaped_path 37 sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $path
21} 38}
22 39
23sub uniq_path { 40sub uniq_path {
24 undef 41 undef
25} 42}
26 43
44sub load_header {
45 my ($self) = @_;
46
47 $self->SUPER::load_header
48 or return;
49
50 # forcefully disable per_player flag
51 $self->per_player (0);
52
53 1
54}
55
271 561
28 57

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines