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