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.64 by root, Mon Jan 1 12:28:45 2007 UTC vs.
Revision 1.66 by pippijn, Wed Jan 3 00:21:35 2007 UTC

487} 487}
488 488
489bool 489bool
490maptile::save_objects (object_freezer &freezer, int flags) 490maptile::save_objects (object_freezer &freezer, int flags)
491{ 491{
492 static int cede_count = 0;
493
492 if (flags & IO_HEADER) 494 if (flags & IO_HEADER)
493 save_header (freezer); 495 save_header (freezer);
494 496
495 if (!spaces) 497 if (!spaces)
496 return false; 498 return false;
497 499
498 for (int i = 0; i < size (); ++i) 500 for (int i = 0; i < size (); ++i)
499 { 501 {
502 if (cede_count >= 500)
503 {
504 cede_count = 0;
505 coroapi::cede ();
506 }
507
500 int unique = 0; 508 int unique = 0;
501 for (object *op = spaces [i].bot; op; op = op->above) 509 for (object *op = spaces [i].bot; op; op = op->above)
502 { 510 {
511 // count per-object, but cede only when modification-safe
512 cede_count++;
513
503 if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR]) 514 if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR])
504 unique = 1; 515 unique = 1;
505 516
506 if (!op->can_map_save ()) 517 if (!op->can_map_save ())
507 continue; 518 continue;
1372 1383
1373/* This is basically the same as out_of_map above, but 1384/* This is basically the same as out_of_map above, but
1374 * instead we return NULL if no map is valid (coordinates 1385 * instead we return NULL if no map is valid (coordinates
1375 * out of bounds and no tiled map), otherwise it returns 1386 * out of bounds and no tiled map), otherwise it returns
1376 * the map as that the coordinates are really on, and 1387 * the map as that the coordinates are really on, and
1377 * updates x and y to be the localized coordinates. 1388 * updates x and y to be the localised coordinates.
1378 * Using this is more efficient of calling out_of_map 1389 * Using this is more efficient of calling out_of_map
1379 * and then figuring out what the real map is 1390 * and then figuring out what the real map is
1380 */ 1391 */
1381maptile * 1392maptile *
1382get_map_from_coord (maptile *m, sint16 *x, sint16 *y) 1393get_map_from_coord (maptile *m, sint16 *x, sint16 *y)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines