diff options
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/being.cpp | 6 | ||||
-rw-r--r-- | src/being/being.h | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index d7b00e1c6..f020de3da 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -214,6 +214,8 @@ Being::Being(const BeingId id, #endif mX(0), mY(0), + mCachedX(0), + mCachedY(0), mSortOffsetY(0), mPixelOffsetY(0), mFixedOffsetY(0), @@ -528,9 +530,9 @@ void Being::setPixelPositionF(const Vector &restrict pos) restrict2 } } -void Being::setDestination(const int dstX, const int dstY) restrict2 +void Being::setDestination(const int dstX, + const int dstY) restrict2 { - // We can't calculate anything without a map anyway. if (!mMap) return; diff --git a/src/being/being.h b/src/being/being.h index 0386f3290..296038876 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -136,7 +136,18 @@ class Being notfinal : public ActorSprite, /** * Creates a path for the being from current position to ex and ey */ - void setDestination(const int dstX, const int dstY) restrict2; + void setDestination(const int dstX, + const int dstY) restrict2; + + void setCachedDestination(const int dstX, + const int dstY) restrict2 + { mCachedX = dstX; mCachedY = dstY; } + + int getCachedX() const A_WARN_UNUSED + { return mCachedX; } + + int getCachedY() const A_WARN_UNUSED + { return mCachedY; } /** * Returns the destination for this being. @@ -1170,6 +1181,8 @@ class Being notfinal : public ActorSprite, int mX; // position in tiles int mY; // position in tiles + int mCachedX; + int mCachedY; int mSortOffsetY; // caculated offset in pixels based on mPixelOffsetY int mPixelOffsetY; // tile height offset in pixels // calculated between tiles |