summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being/localplayer.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 4ef9b7f9d..70600ff2c 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -3062,11 +3062,15 @@ void LocalPlayer::setRealPos(const int x, const int y)
layer->setTile(mCrossX, mCrossY, MapItemType::EMPTY);
}
- if (mShowServerPos && (!layer->getTile(x, y)
- || layer->getTile(x, y)->getType() == MapItemType::EMPTY))
+ if (mShowServerPos)
{
- if (getTileX() != x && getTileY() != y)
- layer->setTile(x, y, MapItemType::CROSS);
+ const MapItem *const mapItem = layer->getTile(x, y);
+
+ if (!mapItem || mapItem->getType() == MapItemType::EMPTY)
+ {
+ if (getTileX() != x && getTileY() != y)
+ layer->setTile(x, y, MapItemType::CROSS);
+ }
}
mCrossX = x;