diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/ea/beingrecv.cpp | 5 | ||||
-rw-r--r-- | src/resources/map/mapheights.h | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index 3b09502f4..b2909576d 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -462,6 +462,11 @@ void BeingRecv::processBeingMove3(Net::MessageIn &msg) { x2 -= dirx[dir]; y2 -= diry[dir]; + // fix possible wrong move outside of map + if (x2 < 0) + x2 = 0; + if (y2 < 0) + y2 = 0; path2.push_back(Position(x2, y2)); if (x2 == x && y2 == y) break; diff --git a/src/resources/map/mapheights.h b/src/resources/map/mapheights.h index a4cd9f699..c3c832a4c 100644 --- a/src/resources/map/mapheights.h +++ b/src/resources/map/mapheights.h @@ -42,8 +42,8 @@ class MapHeights final : public MemoryCounter uint8_t getHeight(const int x, const int y) const { - return x < mWidth && - y < mHeight ? mTiles[x + y * mWidth] : CAST_U8(0U); + return (x < mWidth && + y < mHeight) ? mTiles[x + y * mWidth] : CAST_U8(0U); } int calcMemoryLocal() const override final; |