--- deliantra/server/common/object.C 2006/09/11 20:28:37 1.30 +++ deliantra/server/common/object.C 2006/09/11 23:53:30 1.32 @@ -625,7 +625,6 @@ * value, or vice versa, then add/remove the object from the active list. * This function needs to be called whenever the speed of an object changes. */ - void update_ob_speed (object *op) { @@ -644,10 +643,10 @@ op->speed = 0; #endif } + if (arch_init) - { - return; - } + return; + if (FABS (op->speed) > MIN_ACTIVE_SPEED) { /* If already on active list, don't do anything */ @@ -657,8 +656,10 @@ /* process_events() expects us to insert the object at the beginning * of the list. */ op->active_next = active_objects; + if (op->active_next != NULL) op->active_next->active_prev = op; + active_objects = op; } else @@ -670,15 +671,18 @@ if (op->active_prev == NULL) { active_objects = op->active_next; + if (op->active_next != NULL) op->active_next->active_prev = NULL; } else { op->active_prev->active_next = op->active_next; + if (op->active_next) op->active_next->active_prev = op->active_prev; } + op->active_next = NULL; op->active_prev = NULL; } @@ -903,8 +907,7 @@ object *object::create () { - object * - op; + object *op; if (freed.empty ()) op = new object; @@ -936,12 +939,12 @@ if (QUERY_FLAG (this, FLAG_FREED)) return; - if (!QUERY_FLAG (this, FLAG_REMOVED)) - remove_ob (this); - if (QUERY_FLAG (this, FLAG_FRIENDLY)) remove_friendly_object (this); + if (!QUERY_FLAG (this, FLAG_REMOVED)) + remove_ob (this); + SET_FLAG (this, FLAG_FREED); if (more) @@ -956,7 +959,7 @@ * if some form of movement is allowed, let objects * drop on that space. */ - if (free_inventory || !map || map->in_memory != MAP_IN_MEMORY || (GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL)) + if (free_inventory || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL) { object *op = inv; @@ -2842,3 +2845,14 @@ return set_ob_key_value_s (op, key_, value, add_key); } + +void +object::deep_iterator::next () +{ + if (item->inv) + item = item->inv; + else if (item->below) + item = item->below; + else + item = item->env->below; +}