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.120 by root, Tue Jan 2 11:08:36 2007 UTC vs.
Revision 1.124 by root, Tue Jan 2 22:55:05 2007 UTC

1153# and all this just because we cannot iterate over 1153# and all this just because we cannot iterate over
1154# all maps in C++... 1154# all maps in C++...
1155sub change_all_map_light { 1155sub change_all_map_light {
1156 my ($change) = @_; 1156 my ($change) = @_;
1157 1157
1158 $_->change_map_light ($change) for values %cf::MAP; 1158 $_->change_map_light ($change)
1159 for grep $_->outdoor, values %cf::MAP;
1159} 1160}
1160 1161
1161sub try_load_header($) { 1162sub try_load_header($) {
1162 my ($path) = @_; 1163 my ($path) = @_;
1163 1164
1210 $map->instantiate; 1211 $map->instantiate;
1211 1212
1212 # per-player maps become, after loading, normal maps 1213 # per-player maps become, after loading, normal maps
1213 $map->per_player (0) if $path->{user_rel}; 1214 $map->per_player (0) if $path->{user_rel};
1214 } 1215 }
1215 #Coro::Timer::sleep 1;#d#
1216 1216
1217 $map->path ($key); 1217 $map->path ($key);
1218 $map->{path} = $path; 1218 $map->{path} = $path;
1219 $map->{last_save} = $cf::RUNTIME; 1219 $map->{last_save} = $cf::RUNTIME;
1220 $map->last_access ($cf::RUNTIME); 1220 $map->last_access ($cf::RUNTIME);
1221 1221
1222 if ($map->should_reset) { 1222 if ($map->should_reset) {
1223 $map->reset; 1223 $map->reset;
1224 undef $guard;
1224 $map = find_map $path; 1225 $map = cf::map::find_map ($path)
1226 or return;
1225 } 1227 }
1226 1228
1227 $cf::MAP{$key} = $map 1229 $cf::MAP{$key} = $map
1228 } 1230 }
1229} 1231}
1914 1916
1915{ 1917{
1916 my $path = cf::localdir . "/database.pst"; 1918 my $path = cf::localdir . "/database.pst";
1917 1919
1918 sub db_load() { 1920 sub db_load() {
1919 warn "loading database $path\n";#d# remove later
1920 $DB = stat $path ? Storable::retrieve $path : { }; 1921 $DB = stat $path ? Storable::retrieve $path : { };
1921 } 1922 }
1922 1923
1923 my $pid; 1924 my $pid;
1924 1925
1925 sub db_save() { 1926 sub db_save() {
1926 warn "saving database $path\n";#d# remove later
1927 waitpid $pid, 0 if $pid; 1927 waitpid $pid, 0 if $pid;
1928 if (0 == ($pid = fork)) { 1928 if (0 == ($pid = fork)) {
1929 $DB->{_meta}{version} = 1; 1929 $DB->{_meta}{version} = 1;
1930 Storable::nstore $DB, "$path~"; 1930 Storable::nstore $DB, "$path~";
1931 rename "$path~", $path; 1931 rename "$path~", $path;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines