… | |
… | |
454 | } |
454 | } |
455 | |
455 | |
456 | bool |
456 | bool |
457 | maptile::_save_objects (object_freezer &f, int flags) |
457 | maptile::_save_objects (object_freezer &f, int flags) |
458 | { |
458 | { |
459 | static int cede_count = 0; |
459 | coroapi::cede (); |
460 | |
460 | |
461 | if (flags & IO_HEADER) |
461 | if (flags & IO_HEADER) |
462 | _save_header (f); |
462 | _save_header (f); |
463 | |
463 | |
464 | if (!spaces) |
464 | if (!spaces) |
465 | return false; |
465 | return false; |
466 | |
466 | |
467 | for (int i = 0; i < size (); ++i) |
467 | for (int i = 0; i < size (); ++i) |
468 | { |
468 | { |
|
|
469 | #if 0 // disabled, there still seem to be races somewhere |
|
|
470 | static int cede_count = 0; |
|
|
471 | |
469 | if (cede_count >= 500) |
472 | if (cede_count >= 500) |
470 | { |
473 | { |
471 | cede_count = 0; |
474 | cede_count = 0; |
472 | coroapi::cede (); |
475 | coroapi::cede (); |
473 | } |
476 | } |
|
|
477 | #endif |
474 | |
478 | |
475 | int unique = 0; |
479 | int unique = 0; |
476 | for (object *op = spaces [i].bot; op; op = op->above) |
480 | for (object *op = spaces [i].bot; op; op = op->above) |
477 | { |
481 | { |
478 | // count per-object, but cede only when modification-safe |
482 | // count per-object, but cede only when modification-safe |
… | |
… | |
491 | } |
495 | } |
492 | else if (flags & IO_OBJECTS) |
496 | else if (flags & IO_OBJECTS) |
493 | op->write (f); |
497 | op->write (f); |
494 | } |
498 | } |
495 | } |
499 | } |
|
|
500 | |
|
|
501 | coroapi::cede (); |
496 | |
502 | |
497 | return true; |
503 | return true; |
498 | } |
504 | } |
499 | |
505 | |
500 | bool |
506 | bool |