--- deliantra/server/common/object.C 2006/12/20 01:19:11 1.73 +++ deliantra/server/common/object.C 2006/12/20 09:14:21 1.74 @@ -354,21 +354,6 @@ } /* - * Eneq(@csd.uu.se): Since we can have items buried in a character we need - * a better check. We basically keeping traversing up until we can't - * or find a player. - */ - -object * -is_player_inv (object *op) -{ - for (; op != NULL && op->type != PLAYER; op = op->env) - if (op->env == op) - op->env = NULL; - return op; -} - -/* * Used by: Crossedit: dump. Server DM commands: dumpbelow, dump. * Some error messages. * The result of the dump is stored in the static global errmsg array. @@ -1057,7 +1042,7 @@ * made to players inventory. If set, avoiding the call * to save cpu time. */ - if ((otmp = is_player_inv (env)) != NULL && otmp->contr && !QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) + if ((otmp = in_player ()) && otmp->contr && !QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) fix_player (otmp); if (above != NULL) @@ -1621,7 +1606,7 @@ /* is this object in the players inventory, or sub container * therein? */ - tmp = is_player_inv (op->env); + tmp = op->in_player (); /* nope. Is this a container the player has opened? * If so, set tmp to that player. * IMO, searching through all the players will mostly @@ -1779,15 +1764,15 @@ else add_weight (this, (op->weight + op->carrying)); - otmp = is_player_inv (this); + otmp = this->in_player (); if (otmp && otmp->contr) if (!QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) fix_player (otmp); - op->map = NULL; + op->map = 0; op->env = this; - op->above = NULL; - op->below = NULL; + op->above = 0; + op->below = 0; op->x = 0, op->y = 0; /* reset the light list and los of the players on the map */ @@ -2134,11 +2119,13 @@ * to only the spaces immediately surrounding the target area, and * won't look 2 spaces south of the target space. */ - else if ((flag & AB_NO_PASS) && maxfree[i] < stop) + else if ((flag & P_NO_PASS) && maxfree[i] < stop) stop = maxfree[i]; } + if (!index) return -1; + return altern[RANDOM () % index]; }