--- deliantra/server/common/object.C 2011/05/04 07:36:40 1.346 +++ deliantra/server/common/object.C 2011/05/08 12:40:41 1.350 @@ -739,7 +739,7 @@ mapspace &m = op->ms (); if (!(m.flags_ & P_UPTODATE)) - /* nop */; + m.update_up (); // nothing to do except copy up else if (action == UP_OBJ_INSERT) { #if 0 @@ -770,7 +770,7 @@ else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE) m.invalidate (); else if (action == UP_OBJ_FACE) - /* Nothing to do for that case */ ; + m.update_up (); // nothing to do for that case, except copy up else LOG (llevError, "update_object called with invalid action: %d\n", action); @@ -1007,7 +1007,11 @@ ++free_count; } -static struct freed_map : maptile +// special "grave" map used to store all removed objects +// till they can be destroyed - saves a lot of checks in the rest +// of the code +static struct freed_map +: maptile { freed_map () : maptile (3, 3) @@ -1017,7 +1021,7 @@ no_drop = 1; no_reset = 1; - in_memory = MAP_ACTIVE; + state = MAP_ACTIVE; } ~freed_map () @@ -2412,6 +2416,8 @@ !item->flag [FLAG_ALIVE] && !item->invisible && (who->is_player () || item->weight < who->weight / 3)); } +//-GPL + /* * create clone from object to another */ @@ -2634,6 +2640,8 @@ : region::default_region (); } +//+GPL + void object::open_container (object *new_container) { @@ -2700,6 +2708,38 @@ // contr->ns->floorbox_reset (); } +//-GPL + +// prefetch some flat area around the player +static void +prefetch_surrounding_area (object *op, maptile *map, int range) +{ + for (maprect *rect = map->split_to_tiles (mapwalk_buf, + op->x - range , op->y - range , + op->x + range + 1, op->y + range + 1); + rect->m; + ++rect) + { + rect->m->touch (); + rect->m->activate (); + } +} + +// prefetch a generous area around the player, also up and down +void +object::prefetch_surrounding_maps () +{ + prefetch_surrounding_area (this, map, 40); + + if (maptile *m = map->tile_available (TILE_DOWN)) + prefetch_surrounding_area (this, m, 20); + + if (maptile *m = map->tile_available (TILE_UP)) + prefetch_surrounding_area (this, m, 20); +} + +//+GPL + object * object::force_find (shstr_tmp name) { @@ -2713,8 +2753,6 @@ return 0; } -//-GPL - void object::force_set_timer (int duration) {