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.2 by root, Sat Jan 13 23:32:43 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;
9} 10}
10 11
11sub as_string { 12sub load_path {
12 my ($self) = @_; 13 my ($self) = @_;
13 14
14 "~$self->{user}$self->{path}" 15 sprintf "%s/%s/%s", cf::datadir, cf::mapdir, $self->{orig_path}
15} 16}
16 17
17sub save_path { 18sub save_path {
18 my ($self) = @_; 19 my ($self) = @_;
19 20
21 (my $path = $_[0]{orig_path}) =~ s/\//$PATH_SEP/g;
20 sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $self->_escaped_path 22 sprintf "%s/%s/%s/%s", cf::localdir, cf::playerdir, $self->{user}, $path
21} 23}
22 24
23sub uniq_path { 25sub uniq_path {
24 undef 26 undef
25} 27}
26 28
29sub load_header {
30 my ($self) = @_;
31
32 $self->SUPER::load_header
33 or return;
34
35 # forcefully disable per_player flag
36 $self->per_player (0);
37
38 1
39}
40
271 411
28 42

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines