diff --git a/src/otclient/core/tile.cpp b/src/otclient/core/tile.cpp index b3bffe15..2a26084b 100644 --- a/src/otclient/core/tile.cpp +++ b/src/otclient/core/tile.cpp @@ -199,28 +199,16 @@ ItemPtr Tile::getGround() ThingPtr Tile::getTopLookThing() { - ThingPtr retThing; - // check if there is any lookable object in this tile + if(isEmpty()) + return nullptr; + for(int i = m_things.size() - 1; i >= 0; --i) { ThingPtr thing = m_things[i]; if(!thing->ignoreLook() && (!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop())) return thing; - else if(!thing->ignoreLook()) - retThing = thing; } - // return this, it it is lookable. - if(retThing) - return retThing; - - // if not, check on under tile - Position tilePos = m_position; - tilePos.coveredDown(); - TilePtr tile = g_map.getTile(tilePos); - if(tile) - return tile->getTopLookThing(); - - return nullptr; + return m_things[0]; } ThingPtr Tile::getTopUseThing() diff --git a/src/otclient/ui/uimap.cpp b/src/otclient/ui/uimap.cpp index 2074eafa..09cfd8ce 100644 --- a/src/otclient/ui/uimap.cpp +++ b/src/otclient/ui/uimap.cpp @@ -79,7 +79,7 @@ bool UIMap::onMousePress(const Point& mousePos, Fw::MouseButton button) tilePos.perspectiveUp(tilePos.z - firstFloor); for(int i = firstFloor; i <= Map::MAX_Z; i++) { tile = g_map.getTile(tilePos); - if(!tile || !tile->isEmpty()) + if(tile && !tile->isEmpty() && tile->getGround()) break; tilePos.coveredDown(); }