--- deliantra/server/lib/cf.pm 2007/01/13 23:06:13 1.166 +++ deliantra/server/lib/cf.pm 2007/01/13 23:32:43 1.167 @@ -902,20 +902,6 @@ } ############################################################################# -# load/save/clean perl data associated with a map - -*cf::mapsupport::on_clean = sub { - my ($map) = @_; - - my $path = $map->tmpname; - defined $path or return; - - unlink "$path.pst"; -}; - -cf::map->attach (prio => -10000, package => cf::mapsupport::); - -############################################################################# =head2 CORE EXTENSIONS @@ -1079,6 +1065,7 @@ next if /\.(?:pl|pst)$/; next unless /^$PATH_SEP/o; + s/\.map$//; push @paths, "~" . $pl->ob->name . "/" . $_; } @@ -1222,13 +1209,6 @@ &as_string } -# escape the /'s in the path -sub _escaped_path { - (my $path = $_[0]{path}) =~ s/\//$PATH_SEP/g; - - $path -} - # the original (read-only) location sub load_path { my ($self) = @_; @@ -1240,14 +1220,16 @@ sub save_path { my ($self) = @_; - sprintf "%s/%s/%s.map", cf::localdir, cf::tmpdir, $self->_escaped_path + (my $path = $_[0]{path}) =~ s/\//$PATH_SEP/g; + sprintf "%s/%s/%s", cf::localdir, cf::tmpdir, $path } # the unique path, undef == no special unique path sub uniq_path { my ($self) = @_; - sprintf "%s/%s/%s", cf::localdir, cf::uniquedir, $self->_escaped_path + (my $path = $_[0]{path}) =~ s/\//$PATH_SEP/g; + sprintf "%s/%s/%s", cf::localdir, cf::uniquedir, $path } # and all this just because we cannot iterate over @@ -1546,7 +1528,7 @@ sub reset { my ($self) = @_; - my $lock = cf::lock_acquire "map_data:" . $self->path; + my $lock = cf::lock_acquire "map_data:$self->{path}"; return if $self->players; return if $self->isa ("ext::map_per_player");#d# @@ -1555,6 +1537,9 @@ delete $cf::MAP{$self->path}; + $self->in_memory (cf::MAP_SWAPPED); + $self->clear; + $_->clear_links_to ($self) for values %cf::MAP; $self->unlink_save; @@ -1590,6 +1575,7 @@ next if /\.pst$/; next unless /^$PATH_SEP/o; + s/\.map$//; push @paths, $_; } @@ -2256,7 +2242,7 @@ cf::sync_job { # use a peculiar iteration method to avoid tripping on perl # refcount bugs in for. also avoids problems with players - # and maps saved/Destroyed asynchronously. + # and maps saved/destroyed asynchronously. warn "begin emergency player save\n"; for my $login (keys %cf::PLAYER) { my $pl = $cf::PLAYER{$login} or next;