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.2 by root, Sat Jan 13 23:32:43 2007 UTC vs.
Revision 1.11 by root, Mon Jun 11 21:38:13 2007 UTC

1#! perl # MANDATORY 1#! perl # mandatory
2 2
3cf::map->register (qr{^~([^/]+)(/.*)}); 3cf::map->register (qr{^~([^/]+)(/.*)});
4 4
5sub init { 5sub init {
6 my ($self) = @_; 6 my ($self) = @_;
7 7
8 $self->{user} = $1; 8 $self->{user} = $1;
9 $self->{orig_path} = $2; 9 $self->{orig_path} = $2;
10}
11
12sub thawer_merge {
13 # we have to keep some variables in memory intact
14 local $_[0]{user};
15 local $_[0]{orig_path};
16
17 $_[0]->SUPER::thawer_merge ($_[1]);
10} 18}
11 19
12sub load_path { 20sub load_path {
13 my ($self) = @_; 21 my ($self) = @_;
14 22
15 sprintf "%s/%s/%s", cf::datadir, cf::mapdir, $self->{orig_path} 23 "$cf::MAPDIR/$self->{orig_path}.map"
16} 24}
17 25
18sub save_path { 26sub save_path {
19 my ($self) = @_; 27 my ($self) = @_;
20 28
21 (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g; 29 (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g;
22 sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $path 30 "$cf::PLAYERDIR/$self->{user}/$path.map"
23} 31}
24 32
25sub uniq_path { 33sub uniq_path {
26 undef 34 undef
27} 35}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines