ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-per-player.ext
Revision: 1.10
Committed: Thu Jun 7 19:12:22 2007 UTC (16 years, 11 months ago) by root
Branch: MAIN
Changes since 1.9: +0 -9 lines
Log Message:
- new map header boolean "no_reset 1" to deny reset.
- allow reset of per-player maps, effectviely implementing
  player-private dungeons.
- re-enabled reset-on-load feature again.
- remove fail-safe mechanism that prevented per-player maps from
  being reset. keep your fingers crossed.
- fixed two bugs in archetype finding (archname vs. object name).
- singularities no longer crash the server but will log a backtrace
  now as they are really are fatal.

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 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    
49 root 1.1 1
50