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.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} 10}
10 11
11sub as_string { 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]);
18}
19
20sub load_path {
12 my ($self) = @_; 21 my ($self) = @_;
13 22
14 "~$self->{user}$self->{path}" 23 "$cf::MAPDIR/$self->{orig_path}.map"
15} 24}
16 25
17sub save_path { 26sub save_path {
18 my ($self) = @_; 27 my ($self) = @_;
19 28
20 sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $self->_escaped_path 29 (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g;
30 "$cf::PLAYERDIR/$self->{user}/$path.map"
21} 31}
22 32
23sub uniq_path { 33sub uniq_path {
24 undef 34 undef
25} 35}
26 36
37sub load_header {
38 my ($self) = @_;
39
40 $self->SUPER::load_header
41 or return;
42
43 # forcefully disable per_player flag
44 $self->per_player (0);
45
46 1
47}
48
271 491
28 50

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines