--- deliantra/server/common/object.C 2006/12/31 17:17:22 1.98 +++ deliantra/server/common/object.C 2007/01/03 00:21:35 1.105 @@ -626,7 +626,7 @@ mapspace &m = op->ms (); - if (m.flags_ & P_NEED_UPDATE) + if (!(m.flags_ & P_UPTODATE)) /* nop */; else if (action == UP_OBJ_INSERT) { @@ -645,14 +645,14 @@ */ || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp) - m.flags_ = P_NEED_UPDATE; + m.flags_ = 0; } /* if the object is being removed, we can't make intelligent * decisions, because remove_ob can't really pass the object * that is being removed. */ else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE) - m.flags_ = P_NEED_UPDATE; + m.flags_ = 0; else if (action == UP_OBJ_FACE) /* Nothing to do for that case */ ; else @@ -735,7 +735,7 @@ { activate (); - for (object *op = inv; op; op = op->above) + for (object *op = inv; op; op = op->below) op->activate_recursive (); } @@ -774,7 +774,7 @@ void object::deactivate_recursive () { - for (object *op = inv; op; op = op->above) + for (object *op = inv; op; op = op->below) op->deactivate_recursive (); deactivate (); @@ -872,6 +872,7 @@ freed_map->height = 3; freed_map->alloc (); + freed_map->in_memory = MAP_IN_MEMORY; } map = freed_map; @@ -988,7 +989,7 @@ if (type == PLAYER) { --map->players; - map->last_access = runtime; + map->touch (); } map->dirty = true; @@ -1074,7 +1075,7 @@ /* last == NULL if there are no objects on this space */ //TODO: this makes little sense, why only update the topmost object? if (!last) - map->at (x, y).flags_ = P_NEED_UPDATE; + map->at (x, y).flags_ = 0; else update_object (last, UP_OBJ_REMOVE); @@ -1205,10 +1206,10 @@ object *more = op->more; - /* We really need the caller to normalize coordinates - if + /* We really need the caller to normalise coordinates - if * we set the map, that doesn't work if the location is within * a map and this is straddling an edge. So only if coordinate - * is clear wrong do we normalize it. + * is clear wrong do we normalise it. */ if (OUT_OF_REAL_MAP (more->map, more->x, more->y)) more->map = get_map_from_coord (m, &more->x, &more->y); @@ -1378,7 +1379,7 @@ { op->contr->do_los = 1; ++op->map->players; - op->map->last_access = runtime; + op->map->touch (); } op->map->dirty = true; @@ -1397,7 +1398,7 @@ * on the map will get recalculated. The players could very well * be far away from this change and not affected in any way - * this should get redone to only look for players within range, - * or just updating the P_NEED_UPDATE for spaces within this area + * or just updating the P_UPTODATE for spaces within this area * of effect may be sufficient. */ if (op->map->darkness && (op->glow_radius != 0)) @@ -1445,7 +1446,7 @@ /* first search for itself and remove any old instances */ - for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) + for (tmp = op->ms ().bot; tmp; tmp = tmp->above) if (!strcmp (tmp->arch->name, arch_string)) /* same archetype */ tmp->destroy (); @@ -1778,7 +1779,7 @@ * Hence, we first go to the top: */ - for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp && tmp->above; tmp = tmp->above) + for (tmp = op->ms ().bot; tmp && tmp->above; tmp = tmp->above) { /* Trim the search when we find the first other spell effect * this helps performance so that if a space has 50 spell objects, @@ -1846,13 +1847,13 @@ object * present_arch (const archetype *at, maptile *m, int x, int y) { - if (m == NULL || out_of_map (m, x, y)) + if (!m || out_of_map (m, x, y)) { LOG (llevError, "Present_arch called outside map.\n"); return NULL; } - for (object *tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) + for (object *tmp = m->at (x, y).bot; tmp; tmp = tmp->above) if (tmp->arch == at) return tmp; @@ -1873,7 +1874,7 @@ return NULL; } - for (object *tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) + for (object *tmp = m->at (x, y).bot; tmp; tmp = tmp->above) if (tmp->type == type) return tmp; @@ -2615,6 +2616,8 @@ char *p = desc; bool first = true; + *p = 0; + for (int i = 0; i < NUM_FLAGS; i++) { if (len <= 10) // magic constant! @@ -2623,7 +2626,7 @@ break; } - if (flag[i]) + if (flag [i]) { int cnt = snprintf (p, len, "%s%d", first ? "" : ",", i); len -= cnt; @@ -2635,7 +2638,7 @@ return desc; } -// return a suitable string describing an objetc in enough detail to find it +// return a suitable string describing an object in enough detail to find it const char * object::debug_desc (char *info) const { @@ -2662,7 +2665,7 @@ const char * object::debug_desc () const { - static char info[256 * 3]; + static char info[256 * 4]; return debug_desc (info); }