ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-per-player.ext
Revision: 1.9
Committed: Thu Apr 19 11:12:45 2007 UTC (17 years, 1 month ago) by root
Branch: MAIN
CVS Tags: rel-2_1
Changes since 1.8: +2 -2 lines
Log Message:
fix a number of annoying bugs, doh.

File Contents

# User Rev Content
1 root 1.1 #! perl # MANDATORY
2    
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     $self->{deny_reset} = 1; #d# for now
11 root 1.1 }
12    
13 root 1.4 sub thawer_merge {
14     # we have to keep some variables in memory intact
15     local $_[0]{user};
16     local $_[0]{orig_path};
17     local $_[0]{deny_reset};
18    
19     $_[0]->SUPER::thawer_merge ($_[1]);
20     }
21    
22 root 1.2 sub load_path {
23 root 1.1 my ($self) = @_;
24    
25 root 1.9 "$cf::MAPDIR/$self->{orig_path}.map"
26 root 1.1 }
27    
28     sub save_path {
29     my ($self) = @_;
30    
31 root 1.2 (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g;
32 root 1.9 "$cf::PLAYERDIR/$self->{user}/$path.map"
33 root 1.1 }
34    
35     sub uniq_path {
36     undef
37     }
38    
39 root 1.2 sub load_header {
40     my ($self) = @_;
41    
42     $self->SUPER::load_header
43     or return;
44    
45     # forcefully disable per_player flag
46     $self->per_player (0);
47    
48     1
49     }
50    
51 root 1.6 sub decay_objects {
52     # do nothing on per player maps at the moment
53     # to protect apartments.
54     # TODO: apartments should be marked as such
55     # (no reset, no decay etc.)
56     }
57    
58 root 1.1 1
59