| 1 |
#! perl # mandatory |
| 2 |
|
| 3 |
cf::map->register (qr{^~([^/]+)(/.*)}); |
| 4 |
|
| 5 |
sub init { |
| 6 |
my ($self) = @_; |
| 7 |
|
| 8 |
$self->{user} = $1; |
| 9 |
$self->{orig_path} = $2; |
| 10 |
} |
| 11 |
|
| 12 |
sub 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 |
|
| 20 |
sub load_path { |
| 21 |
my ($self) = @_; |
| 22 |
|
| 23 |
"$cf::MAPDIR/$self->{orig_path}.map" |
| 24 |
} |
| 25 |
|
| 26 |
sub save_path { |
| 27 |
my ($self) = @_; |
| 28 |
|
| 29 |
(my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g; |
| 30 |
"$cf::PLAYERDIR/$self->{user}/$path.map" |
| 31 |
} |
| 32 |
|
| 33 |
sub uniq_path { |
| 34 |
undef |
| 35 |
} |
| 36 |
|
| 37 |
sub 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 |
|