summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-25 12:35:27 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-25 12:35:27 +0300
commit5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4 (patch)
treea2bcd31ace81a4a3df29ff4c580d6d57cb10a0b0 /src/being/being.cpp
parent219424dc0e194a722bc93ba51b973fda8715869f (diff)
downloadplus-5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4.tar.gz
plus-5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4.tar.bz2
plus-5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4.tar.xz
plus-5c0999cb674ceb43d2244e4eaba225f8ffa4ccb4.zip
extend pet follow logic with follow in fixed position to owner.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index b7d6019ec..a8b3eaf8c 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1650,28 +1650,34 @@ void Being::petLogic()
}
else if (divX > followDist || divY > followDist)
{
- if (divX > followDist)
+ if (!dist)
{
- if (dstX > mX + dist)
- dstX -= dist;
- else if (dstX + dist <= mX)
- dstX += dist;
+ fixPetSpawnPos(dstX, dstY);
}
else
{
- dstX = mX;
- }
-
- if (divY > followDist)
- {
- if (dstY > mY + dist)
- dstY -= dist;
- else if (dstX + dist <= mX)
- dstY += dist;
- }
- else
- {
- dstY = mY;
+ if (divX > followDist)
+ {
+ if (dstX > mX + dist)
+ dstX -= dist;
+ else if (dstX + dist <= mX)
+ dstX += dist;
+ }
+ else
+ {
+ dstX = mX;
+ }
+ if (divY > followDist)
+ {
+ if (dstY > mY + dist)
+ dstY -= dist;
+ else if (dstX + dist <= mX)
+ dstY += dist;
+ }
+ else
+ {
+ dstY = mY;
+ }
}
const int walkMask = getWalkMask();
@@ -3191,7 +3197,7 @@ void Being::fixPetSpawnPos(int &dstX, int &dstY) const
switch (mOwner->getDirection())
{
case LEFT:
- offsetX = offsetY1;
+ offsetX = -offsetY1;
offsetY = -offsetX1;
break;
case RIGHT: