… | |
… | |
361 | } |
361 | } |
362 | |
362 | |
363 | void |
363 | void |
364 | maptile::activate () |
364 | maptile::activate () |
365 | { |
365 | { |
366 | if (spaces) |
366 | if (in_memory != MAP_INACTIVE) |
|
|
367 | return; |
|
|
368 | |
367 | for (mapspace *ms = spaces + size (); ms-- > spaces; ) |
369 | for (mapspace *ms = spaces + size (); ms-- > spaces; ) |
368 | for (object *op = ms->bot; op; op = op->above) |
370 | for (object *op = ms->bot; op; op = op->above) |
369 | op->activate_recursive (); |
371 | op->activate_recursive (); |
|
|
372 | |
|
|
373 | in_memory = MAP_ACTIVE; |
370 | } |
374 | } |
371 | |
375 | |
372 | void |
376 | void |
373 | maptile::deactivate () |
377 | maptile::deactivate () |
374 | { |
378 | { |
375 | if (spaces) |
379 | if (in_memory != MAP_ACTIVE) |
|
|
380 | return; |
|
|
381 | |
376 | for (mapspace *ms = spaces + size (); ms-- > spaces; ) |
382 | for (mapspace *ms = spaces + size (); ms-- > spaces; ) |
377 | for (object *op = ms->bot; op; op = op->above) |
383 | for (object *op = ms->bot; op; op = op->above) |
378 | op->deactivate_recursive (); |
384 | op->deactivate_recursive (); |
|
|
385 | |
|
|
386 | in_memory = MAP_INACTIVE; |
379 | } |
387 | } |
380 | |
388 | |
381 | bool |
389 | bool |
382 | maptile::_save_objects (object_freezer &f, int flags) |
390 | maptile::_save_objects (object_freezer &f, int flags) |
383 | { |
391 | { |
… | |
… | |
1198 | maptile::tile_available (int dir, bool load) |
1206 | maptile::tile_available (int dir, bool load) |
1199 | { |
1207 | { |
1200 | if (tile_path[dir]) |
1208 | if (tile_path[dir]) |
1201 | { |
1209 | { |
1202 | // map is there and we don't need to load it OR it's loaded => return what we have |
1210 | // map is there and we don't need to load it OR it's loaded => return what we have |
1203 | if (tile_map[dir] && (!load || tile_map[dir]->in_memory == MAP_ACTIVE)) |
1211 | if (tile_map[dir] && (!load || tile_map[dir]->linkable ())) |
1204 | return tile_map[dir]; |
1212 | return tile_map[dir]; |
1205 | |
1213 | |
1206 | // well, try to locate it then, if possible - maybe it's there already |
1214 | // well, try to locate it then, if possible - maybe it's there already |
1207 | if ((tile_map[dir] = find_async (tile_path[dir], this, load))) |
1215 | if ((tile_map[dir] = find_async (tile_path[dir], this, load))) |
1208 | return tile_map[dir]; |
1216 | return tile_map[dir]; |