ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/map.C
(Generate patch)

Comparing deliantra/server/common/map.C (file contents):
Revision 1.63 by root, Mon Jan 1 00:41:02 2007 UTC vs.
Revision 1.65 by root, Mon Jan 1 21:19:51 2007 UTC

329 * carrying. 329 * carrying.
330 */ 330 */
331 sum_weight (container); 331 sum_weight (container);
332} 332}
333 333
334void
335maptile::set_object_flag (int flag, int value)
336{
337 if (!spaces)
338 return;
339
340 for (mapspace *ms = spaces + size (); ms-- > spaces; )
341 for (object *tmp = ms->bot; tmp; tmp = tmp->above)
342 tmp->flag [flag] = value;
343}
344
334/* link_multipart_objects go through all the objects on the map looking 345/* link_multipart_objects go through all the objects on the map looking
335 * for objects whose arch says they are multipart yet according to the 346 * for objects whose arch says they are multipart yet according to the
336 * info we have, they only have the head (as would be expected when 347 * info we have, they only have the head (as would be expected when
337 * they are saved). We do have to look for the old maps that did save 348 * they are saved). We do have to look for the old maps that did save
338 * the more sections and not re-add sections for them. 349 * the more sections and not re-add sections for them.
476} 487}
477 488
478bool 489bool
479maptile::save_objects (object_freezer &freezer, int flags) 490maptile::save_objects (object_freezer &freezer, int flags)
480{ 491{
492 static int cede_count = 0;
493
481 if (flags & IO_HEADER) 494 if (flags & IO_HEADER)
482 save_header (freezer); 495 save_header (freezer);
483 496
484 if (!spaces) 497 if (!spaces)
485 return false; 498 return false;
486 499
487 for (int i = 0; i < size (); ++i) 500 for (int i = 0; i < size (); ++i)
488 { 501 {
502 if (cede_count >= 500)
503 {
504 cede_count = 0;
505 coroapi::cede ();
506 }
507
489 int unique = 0; 508 int unique = 0;
490 for (object *op = spaces [i].bot; op; op = op->above) 509 for (object *op = spaces [i].bot; op; op = op->above)
491 { 510 {
511 // count per-object, but cede only when modification-safe
512 cede_count++;
513
492 if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR]) 514 if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR])
493 unique = 1; 515 unique = 1;
494 516
495 if (!op->can_map_save ()) 517 if (!op->can_map_save ())
496 continue; 518 continue;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines