--- deliantra/server/common/map.C 2006/12/31 22:23:11 1.62 +++ deliantra/server/common/map.C 2007/01/03 00:21:35 1.66 @@ -331,6 +331,17 @@ sum_weight (container); } +void +maptile::set_object_flag (int flag, int value) +{ + if (!spaces) + return; + + for (mapspace *ms = spaces + size (); ms-- > spaces; ) + for (object *tmp = ms->bot; tmp; tmp = tmp->above) + tmp->flag [flag] = value; +} + /* link_multipart_objects go through all the objects on the map looking * for objects whose arch says they are multipart yet according to the * info we have, they only have the head (as would be expected when @@ -478,6 +489,8 @@ bool maptile::save_objects (object_freezer &freezer, int flags) { + static int cede_count = 0; + if (flags & IO_HEADER) save_header (freezer); @@ -486,9 +499,18 @@ for (int i = 0; i < size (); ++i) { + if (cede_count >= 500) + { + cede_count = 0; + coroapi::cede (); + } + int unique = 0; for (object *op = spaces [i].bot; op; op = op->above) { + // count per-object, but cede only when modification-safe + cede_count++; + if (op->flag [FLAG_UNIQUE] && op->flag [FLAG_IS_FLOOR]) unique = 1; @@ -890,6 +912,7 @@ if (tile_path [2]) MAP_OUT2 (tile_path_3, tile_path [2]); if (tile_path [3]) MAP_OUT2 (tile_path_4, tile_path [3]); + freezer.put (this); freezer.put (KW_end); return true; @@ -1362,7 +1385,7 @@ * instead we return NULL if no map is valid (coordinates * out of bounds and no tiled map), otherwise it returns * the map as that the coordinates are really on, and - * updates x and y to be the localized coordinates. + * updates x and y to be the localised coordinates. * Using this is more efficient of calling out_of_map * and then figuring out what the real map is */