--- deliantra/server/common/map.C 2009/10/12 14:00:57 1.160 +++ deliantra/server/common/map.C 2009/10/13 18:22:44 1.162 @@ -73,9 +73,6 @@ int blocked_link (object *ob, maptile *m, int sx, int sy) { - object *tmp; - int mflags, blocked; - /* Make sure the coordinates are valid - they should be, as caller should * have already checked this. */ @@ -88,9 +85,10 @@ /* Save some cycles - instead of calling get_map_flags(), just get the value * directly. */ - mflags = m->at (sx, sy).flags (); + mapspace &ms = m->at (sx, sy); - blocked = GET_MAP_MOVE_BLOCK (m, sx, sy); + int mflags = ms.flags (); + int blocked = ms.move_block; /* If space is currently not blocked by anything, no need to * go further. Not true for players - all sorts of special @@ -99,7 +97,7 @@ if (ob->type != PLAYER && !(mflags & P_IS_ALIVE) && (blocked == 0)) return 0; - /* if there isn't anytyhing alive on this space, and this space isn't + /* if there isn't anything alive on this space, and this space isn't * otherwise blocked, we can return now. Only if there is a living * creature do we need to investigate if it is part of this creature * or another. Likewise, only if something is blocking us do we @@ -116,54 +114,57 @@ * true. If we get through the entire stack, that must mean * ob is blocking it, so return 0. */ - for (tmp = GET_MAP_OB (m, sx, sy); tmp; tmp = tmp->above) + for (object *tmp = ms.bot; tmp; tmp = tmp->above) { + bool block = OB_MOVE_BLOCK (ob, tmp); /* This must be before the checks below. Code for inventory checkers. */ - if (tmp->type == CHECK_INV && OB_MOVE_BLOCK (ob, tmp)) + if (block && tmp->type == CHECK_INV) { + bool have = check_inv_recursive (ob, tmp); + /* If last_sp is set, the player/monster needs an object, * so we check for it. If they don't have it, they can't * pass through this space. */ if (tmp->last_sp) { - if (check_inv_recursive (ob, tmp) == NULL) + if (!have) return 1; - else - continue; } else { /* In this case, the player must not have the object - * if they do, they can't pass through. */ - if (check_inv_recursive (ob, tmp) != NULL) /* player has object */ + if (have) return 1; - else - continue; } - } /* if check_inv */ + } + else if (block && tmp->type == T_MATCH) + { + //TODO + } else { /* Broke apart a big nasty if into several here to make * this more readable. first check - if the space blocks * movement, can't move here. * second - if a monster, can't move there, unless it is a - * hidden dm + * dm. */ - if (OB_MOVE_BLOCK (ob, tmp)) + if (block) return 1; if (tmp->flag [FLAG_ALIVE] && tmp->head_ () != ob && tmp != ob && tmp->type != DOOR - && !(tmp->flag [FLAG_WIZ] && tmp->contr->hidden)) + && !tmp->flag [FLAG_WIZ]) return 1; } - } + return 0; }