Skip to content

Commit

Permalink
fix: onLook is selecting incorrect floor as (first) reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Nottinghster authored Feb 24, 2024
1 parent 6b112c2 commit b7b3cf4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/client/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,27 @@ bool Tile::isCovered(int8_t firstFloor)
return (m_isCovered & idState) == idState;
}

bool Tile::isClickable()
{
bool hasGround = false;
bool hasOnBottom = false;
bool hasIgnoreLook = false;
for (const auto& thing : m_things) {
if (thing->isGround())
hasGround = true;
else if (thing->isOnBottom())
hasOnBottom = true;

if (thing->isIgnoreLook())
hasIgnoreLook = true;

if ((hasGround || hasOnBottom) && !hasIgnoreLook)
return true;
}

return false;
}

void Tile::onAddInMapView()
{
m_drawTopAndCreature = true;
Expand Down
2 changes: 1 addition & 1 deletion src/client/tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Tile : public AttachableObject
int getThingCount() { return m_things.size() + m_effects.size(); }

bool isWalkable(bool ignoreCreatures = false);
bool isClickable() { return (hasGround() || hasBottomItem()) && !hasIgnoreLook(); }
bool isClickable();
bool isPathable() { return (m_thingTypeFlag & TileThingType::NOT_PATHABLE) == 0; }
bool isFullGround() { return m_thingTypeFlag & TileThingType::FULL_GROUND; }
bool isFullyOpaque() { return m_thingTypeFlag & TileThingType::IS_OPAQUE; }
Expand Down

0 comments on commit b7b3cf4

Please sign in to comment.