diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-25 15:28:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-25 15:30:08 +0300 |
commit | 2f9fa7415d501337a32111ef123f361cd6d01cab (patch) | |
tree | bff64eaa4f5db487187f6b604db9ce0317746a16 /src/being/being.cpp | |
parent | 3e43345f804886a3a6ed7c0e378612612de4f4a5 (diff) | |
download | plus-2f9fa7415d501337a32111ef123f361cd6d01cab.tar.gz plus-2f9fa7415d501337a32111ef123f361cd6d01cab.tar.bz2 plus-2f9fa7415d501337a32111ef123f361cd6d01cab.tar.xz plus-2f9fa7415d501337a32111ef123f361cd6d01cab.zip |
add pet think time.
New pet db attribute: thinkTime
time in milliseconds.
also remove extra pet logic calls.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index e93675e5a..bbf011a68 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1337,8 +1337,6 @@ void Being::setDirection(const uint8_t direction) if (mAnimationEffect) mAnimationEffect->setSpriteDirection(dir); recalcSpritesOrder(); - if (mPet) - mPet->petLogic(); } uint8_t Being::calcDirection() const @@ -1633,6 +1631,14 @@ void Being::petLogic() { if (!mOwner || !mMap || !mInfo) return; + + const int time = tick_time; + const int thinkTime = mInfo->getThinkTime(); + if (abs(mMoveTime - time) < thinkTime) + return; + + mMoveTime = time; + const int dstX0 = mOwner->getTileX(); const int dstY0 = mOwner->getTileY(); int dstX = dstX0; @@ -3190,12 +3196,6 @@ void Being::updatePets() } } -void Being::updatePet() -{ - if (mPet) - mPet->petLogic(); -} - void Being::fixPetSpawnPos(int &dstX, int &dstY) const { if (!mInfo || !mOwner) |