ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-per-player.ext
Revision: 1.12
Committed: Tue May 4 21:45:42 2010 UTC (14 years ago) by root
Branch: MAIN
CVS Tags: rel-3_1, rel-3_0, HEAD
Changes since 1.11: +0 -2 lines
Log Message:
*** empty log message ***

File Contents

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