… | |
… | |
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 | |
… | |
… | |
1174 | $map->{load_path} = $path; |
1175 | $map->{load_path} = $path; |
1175 | |
1176 | |
1176 | $map |
1177 | $map |
1177 | } |
1178 | } |
1178 | |
1179 | |
|
|
1180 | sub find_map; |
1179 | sub find_map { |
1181 | sub find_map { |
1180 | my ($path, $origin) = @_; |
1182 | my ($path, $origin) = @_; |
1181 | |
1183 | |
1182 | #warn "find_map<$path,$origin>\n";#d# |
1184 | #warn "find_map<$path,$origin>\n";#d# |
1183 | |
1185 | |
… | |
… | |
1218 | $map->{last_save} = $cf::RUNTIME; |
1220 | $map->{last_save} = $cf::RUNTIME; |
1219 | $map->last_access ($cf::RUNTIME); |
1221 | $map->last_access ($cf::RUNTIME); |
1220 | |
1222 | |
1221 | if ($map->should_reset) { |
1223 | if ($map->should_reset) { |
1222 | $map->reset; |
1224 | $map->reset; |
|
|
1225 | undef $guard; |
1223 | $map = find_map $path; |
1226 | $map = find_map $path |
|
|
1227 | or return; |
1224 | } |
1228 | } |
1225 | |
1229 | |
1226 | $cf::MAP{$key} = $map |
1230 | $cf::MAP{$key} = $map |
1227 | } |
1231 | } |
1228 | } |
1232 | } |
… | |
… | |
2188 | or warn "ERROR: unable to write runtime file: $!"; |
2192 | or warn "ERROR: unable to write runtime file: $!"; |
2189 | })->(); |
2193 | })->(); |
2190 | }, |
2194 | }, |
2191 | ); |
2195 | ); |
2192 | |
2196 | |
|
|
2197 | END { cf::emergency_save } |
|
|
2198 | |
2193 | 1 |
2199 | 1 |
2194 | |
2200 | |