bool hasMatchingWallBrushAtTile(BaseMap* map, WallBrush* wall_brush, uint x, uint y, uint z) { Tile* t = map->getTile(x, y, z); if(!t) return false; ItemVector::const_iterator it = t->items.begin(); for(; it != t->items.end(); ++it) { Item* item = *it; if(item->isWall()) { WallBrush* wb = item->getWallBrush(); if(wb == wall_brush) { return !item_db[item->getID()].wall_hate_me; } else if(wall_brush->friendOf(wb) || wb->friendOf(wall_brush)) { return !item_db[item->getID()].wall_hate_me; } } } return false; }