diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-25 14:54:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-25 14:54:25 +0300 |
commit | 3e43345f804886a3a6ed7c0e378612612de4f4a5 (patch) | |
tree | ea7e36388a7ac1cc57ced5b33651b919302b3804 /src/being | |
parent | db67d909cfa5d6a53552bbdb80c215fb382f00d5 (diff) | |
download | mv-3e43345f804886a3a6ed7c0e378612612de4f4a5.tar.gz mv-3e43345f804886a3a6ed7c0e378612612de4f4a5.tar.bz2 mv-3e43345f804886a3a6ed7c0e378612612de4f4a5.tar.xz mv-3e43345f804886a3a6ed7c0e378612612de4f4a5.zip |
add support for pet offsets if owner is sitting.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/being.cpp | 29 | ||||
-rw-r--r-- | src/being/being.h | 2 |
2 files changed, 26 insertions, 5 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 00ef62e0a..e93675e5a 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1698,8 +1698,11 @@ void Being::petLogic() dstX = dstX0; } } - setPath(mMap->findPath(mX, mY, dstX, dstY, walkMask)); - Net::getPetHandler()->move(mOwner, mX, mY, dstX, dstY); + if (mX != dstX || mY != dstY) + { + setPath(mMap->findPath(mX, mY, dstX, dstY, walkMask)); + Net::getPetHandler()->move(mOwner, mX, mY, dstX, dstY); + } } } @@ -3187,13 +3190,30 @@ void Being::updatePets() } } +void Being::updatePet() +{ + if (mPet) + mPet->petLogic(); +} + void Being::fixPetSpawnPos(int &dstX, int &dstY) const { if (!mInfo || !mOwner) return; - const int offsetX1 = mInfo->getTargetOffsetX(); - const int offsetY1 = mInfo->getTargetOffsetY(); + int offsetX1; + int offsetY1; + if (mOwner->getCurrentAction() == SIT) + { + offsetX1 = mInfo->getSitOffsetX(); + offsetY1 = mInfo->getSitOffsetY(); + } + else + { + offsetX1 = mInfo->getTargetOffsetX(); + offsetY1 = mInfo->getTargetOffsetY(); + } + int offsetX = offsetX1; int offsetY = offsetY1; switch (mOwner->getDirection()) @@ -3214,7 +3234,6 @@ void Being::fixPetSpawnPos(int &dstX, int &dstY) const case DOWN: break; } - logger->log("fix offset: %d,%d", offsetX, offsetY); dstX += offsetX; dstY += offsetY; } diff --git a/src/being/being.h b/src/being/being.h index e8bc7da37..99e9dda45 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -881,6 +881,8 @@ class Being : public ActorSprite, public ConfigListener void updatePets(); + void updatePet(); + void fixPetSpawnPos(int &dstX, int &dstY) const; Being *getPet() |