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.6 by root, Thu Jan 18 16:20:40 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;
10 $self->{deny_reset} = 1; #d# for now
9} 11}
10 12
11sub as_string { 13sub 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
22sub load_path {
12 my ($self) = @_; 23 my ($self) = @_;
13 24
14 "~$self->{user}$self->{path}" 25 sprintf "%s/%s/%s", cf::datadir, cf::mapdir, $self->{orig_path}
15} 26}
16 27
17sub save_path { 28sub save_path {
18 my ($self) = @_; 29 my ($self) = @_;
19 30
31 (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g;
20 sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $self->_escaped_path 32 sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $path
21} 33}
22 34
23sub uniq_path { 35sub uniq_path {
24 undef 36 undef
25} 37}
26 38
39sub 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
51sub 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
271 581
28 59

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines