From 293d5be21d3f23102ed6d507fea3dc56a5df8024 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 17 Sep 2013 21:33:43 +0300 Subject: fix heights offset on spawn time. --- src/being/being.cpp | 15 +++++++++++++++ src/being/being.h | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index 6d1307fab..5b1e49a8c 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -3056,3 +3056,18 @@ void Being::setLook(const int look) if (mType == PLAYER) setSubtype(mSubType, look); } + +void Being::setTileCoords(const int x, const int y) +{ + mX = x; + mY = y; + if (mMap) + mOffsetY = mMap->getHeightOffset(mX, mY); +} + +void Being::setMap(Map *const map) +{ + Actor::setMap(map); + if (mMap) + mOffsetY = mMap->getHeightOffset(mX, mY); +} diff --git a/src/being/being.h b/src/being/being.h index f6e2d3f49..8d7db49a5 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -231,8 +231,7 @@ class Being : public ActorSprite, public ConfigListener /** * Sets the tile x and y coord */ - void setTileCoords(const int x, const int y) - { mX = x; mY = y; } + void setTileCoords(const int x, const int y); /** * Puts a "speech balloon" above this being for the specified amount @@ -900,6 +899,8 @@ class Being : public ActorSprite, public ConfigListener int getSortPixelY() const A_WARN_UNUSED { return static_cast(mPos.y) - mYDiff - mSortOffsetY; } + void setMap(Map *const map); + protected: /** * Updates name's location. -- cgit v1.2.3-70-g09d2