ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.130 by root, Thu Jan 4 00:08:08 2007 UTC vs.
Revision 1.132 by root, Thu Jan 4 01:35:56 2007 UTC

71mkdir cf::localdir . "/" . cf::uniquedir; 71mkdir cf::localdir . "/" . cf::uniquedir;
72mkdir $RANDOM_MAPS; 72mkdir $RANDOM_MAPS;
73 73
74# a special map that is always available 74# a special map that is always available
75our $LINK_MAP; 75our $LINK_MAP;
76 76our $EMERGENCY_POSITION;
77our $EMERGENCY_POSITION = $cf::CFG{emergency_position} || ["/world/world_105_115", 5, 37];
78 77
79############################################################################# 78#############################################################################
80 79
81=head2 GLOBAL VARIABLES 80=head2 GLOBAL VARIABLES
82 81
1204 1203
1205 # do it the slow way 1204 # do it the slow way
1206 my $map = try_load_header $path->save_path; 1205 my $map = try_load_header $path->save_path;
1207 1206
1208 if ($map) { 1207 if ($map) {
1208 $map->last_access ((delete $map->{last_access})
1209 || $cf::RUNTIME); #d#
1209 # safety 1210 # safety
1210 $map->{instantiate_time} = $cf::RUNTIME 1211 $map->{instantiate_time} = $cf::RUNTIME
1211 if $map->{instantiate_time} > $cf::RUNTIME; 1212 if $map->{instantiate_time} > $cf::RUNTIME;
1212 } else { 1213 } else {
1213 if (my $rmp = $path->random_map_params) { 1214 if (my $rmp = $path->random_map_params) {
1218 1219
1219 $map or return; 1220 $map or return;
1220 1221
1221 $map->{load_original} = 1; 1222 $map->{load_original} = 1;
1222 $map->{instantiate_time} = $cf::RUNTIME; 1223 $map->{instantiate_time} = $cf::RUNTIME;
1224 $map->last_access ($cf::RUNTIME);
1223 $map->instantiate; 1225 $map->instantiate;
1224 1226
1225 # per-player maps become, after loading, normal maps 1227 # per-player maps become, after loading, normal maps
1226 $map->per_player (0) if $path->{user_rel}; 1228 $map->per_player (0) if $path->{user_rel};
1227 } 1229 }
1228 1230
1229 $map->path ($key); 1231 $map->path ($key);
1230 $map->{path} = $path; 1232 $map->{path} = $path;
1231 $map->{last_save} = $cf::RUNTIME; 1233 $map->{last_save} = $cf::RUNTIME;
1232 $map->last_access ($cf::RUNTIME);
1233 1234
1234 if ($map->should_reset) { 1235 if ($map->should_reset) {
1235 $map->reset; 1236 $map->reset;
1236 undef $guard; 1237 undef $guard;
1237 $map = find_map $path 1238 $map = find_map $path
1311 1312
1312 $self->{load_path} = $save; 1313 $self->{load_path} = $save;
1313 1314
1314 return if $self->{deny_save}; 1315 return if $self->{deny_save};
1315 1316
1317 local $self->{last_access} = $self->last_access;#d#
1318
1316 if ($uniq) { 1319 if ($uniq) {
1317 $self->save_objects ($save, cf::IO_HEADER | cf::IO_OBJECTS); 1320 $self->save_objects ($save, cf::IO_HEADER | cf::IO_OBJECTS);
1318 $self->save_objects ($uniq, cf::IO_UNIQUES); 1321 $self->save_objects ($uniq, cf::IO_UNIQUES);
1319 } else { 1322 } else {
1320 $self->save_objects ($save, cf::IO_HEADER | cf::IO_OBJECTS | cf::IO_UNIQUES); 1323 $self->save_objects ($save, cf::IO_HEADER | cf::IO_OBJECTS | cf::IO_UNIQUES);
1988 open my $fh, "<:utf8", cf::confdir . "/config" 1991 open my $fh, "<:utf8", cf::confdir . "/config"
1989 or return; 1992 or return;
1990 1993
1991 local $/; 1994 local $/;
1992 *CFG = YAML::Syck::Load <$fh>; 1995 *CFG = YAML::Syck::Load <$fh>;
1996
1997 $EMERGENCY_POSITION = $CFG{emergency_position} || ["/world/world_105_115", 5, 37];
1998
1999 if (exists $CFG{mlockall}) {
2000 eval {
2001 $CFG{mlockall} ? &mlockall : &munlockall
2002 and die "WARNING: m(un)lockall failed: $!\n";
2003 };
2004 warn $@ if $@;
2005 }
1993} 2006}
1994 2007
1995sub main { 2008sub main {
1996 # we must not ever block the main coroutine 2009 # we must not ever block the main coroutine
1997 local $Coro::idle = sub { 2010 local $Coro::idle = sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines