… | |
… | |
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++... |
1155 | sub change_all_map_light { |
1155 | sub 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 | |
1161 | sub try_load_header($) { |
1162 | sub 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); |
… | |
… | |
1914 | |
1914 | |
1915 | { |
1915 | { |
1916 | my $path = cf::localdir . "/database.pst"; |
1916 | my $path = cf::localdir . "/database.pst"; |
1917 | |
1917 | |
1918 | sub db_load() { |
1918 | sub db_load() { |
1919 | warn "loading database $path\n";#d# remove later |
|
|
1920 | $DB = stat $path ? Storable::retrieve $path : { }; |
1919 | $DB = stat $path ? Storable::retrieve $path : { }; |
1921 | } |
1920 | } |
1922 | |
1921 | |
1923 | my $pid; |
1922 | my $pid; |
1924 | |
1923 | |
1925 | sub db_save() { |
1924 | sub db_save() { |
1926 | warn "saving database $path\n";#d# remove later |
|
|
1927 | waitpid $pid, 0 if $pid; |
1925 | waitpid $pid, 0 if $pid; |
1928 | if (0 == ($pid = fork)) { |
1926 | if (0 == ($pid = fork)) { |
1929 | $DB->{_meta}{version} = 1; |
1927 | $DB->{_meta}{version} = 1; |
1930 | Storable::nstore $DB, "$path~"; |
1928 | Storable::nstore $DB, "$path~"; |
1931 | rename "$path~", $path; |
1929 | rename "$path~", $path; |