summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-05 01:35:02 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-05 01:35:02 +0300
commit097ef639a433f5d87d675ee7551a1640788031bd (patch)
tree6d38ea5a0b134e402d8824e15ee215351b594360 /src/being
parent21b14e4b8708be1d9b804f61330ef7cd5521397d (diff)
downloadmanaplus-097ef639a433f5d87d675ee7551a1640788031bd.tar.gz
manaplus-097ef639a433f5d87d675ee7551a1640788031bd.tar.bz2
manaplus-097ef639a433f5d87d675ee7551a1640788031bd.tar.xz
manaplus-097ef639a433f5d87d675ee7551a1640788031bd.zip
Rename actor functions getPosition and setPosition.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/actor.h4
-rw-r--r--src/being/being.cpp6
-rw-r--r--src/being/being.h10
-rw-r--r--src/being/localplayer.cpp23
4 files changed, 22 insertions, 21 deletions
diff --git a/src/being/actor.h b/src/being/actor.h
index 875d162bb..0b83e46be 100644
--- a/src/being/actor.h
+++ b/src/being/actor.h
@@ -70,13 +70,13 @@ class Actor notfinal
/**
* Returns the pixel position of this actor.
*/
- const Vector &getPosition() const A_WARN_UNUSED
+ const Vector &getPixelPositionF() const A_WARN_UNUSED
{ return mPos; }
/**
* Sets the pixel position of this actor.
*/
- virtual void setPosition(const Vector &restrict pos) restrict2
+ virtual void setPixelPositionF(const Vector &restrict pos) restrict2
{ mPos = pos; }
/**
diff --git a/src/being/being.cpp b/src/being/being.cpp
index bd09a36c2..c45616ee8 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -510,9 +510,9 @@ TargetCursorSizeT Being::getTargetCursorSize() const restrict2
return mInfo->getTargetCursorSize();
}
-void Being::setPosition(const Vector &restrict pos) restrict2
+void Being::setPixelPositionF(const Vector &restrict pos) restrict2
{
- Actor::setPosition(pos);
+ Actor::setPixelPositionF(pos);
updateCoords();
@@ -1843,7 +1843,7 @@ void Being::logic() restrict2
- (mOldHeight + mOffsetY) * halfTile + offset2;
// Update pixel coordinates
- setPosition(static_cast<float>(mX * mapTileSize
+ setPixelPositionF(static_cast<float>(mX * mapTileSize
+ mapTileSize / 2 + xOffset), yOffset3);
}
diff --git a/src/being/being.h b/src/being/being.h
index 2f03bd877..dd0c64af0 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -481,17 +481,17 @@ class Being notfinal : public ActorSprite,
A_WARN_UNUSED
{ return mSpriteDirection; }
- void setPosition(const Vector &restrict pos) restrict2 override;
+ void setPixelPositionF(const Vector &restrict pos) restrict2 override;
/**
* Overloaded method provided for convenience.
*
* @see setPosition(const Vector &pos)
*/
- inline void setPosition(const float x,
- const float y,
- const float z = 0.0F) restrict2 A_INLINE
- { setPosition(Vector(x, y, z)); }
+ inline void setPixelPositionF(const float x,
+ const float y,
+ const float z = 0.0F) restrict2 A_INLINE
+ { setPixelPositionF(Vector(x, y, z)); }
/**
* Returns the horizontal size of the current base sprite of the being.
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index fed3a4d2c..87b2d8213 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -497,7 +497,7 @@ bool LocalPlayer::pickUp(FloorItem *const item)
}
else if (pickUpType >= 4 && pickUpType <= 6)
{
- const Vector &playerPos = getPosition();
+ const Vector &playerPos = getPixelPositionF();
const Path debugPath = mMap->findPath(
CAST_S32(playerPos.x - mapTileSize / 2) / mapTileSize,
CAST_S32(playerPos.y - mapTileSize) / mapTileSize,
@@ -685,13 +685,14 @@ void LocalPlayer::stopWalking(const bool sendToServer)
mWalkingDir = 0;
mPickUpTarget = nullptr;
- setDestination(CAST_S32(getPosition().x),
- CAST_S32(getPosition().y));
+ const Vector &pos = getPixelPositionF();
+ setDestination(CAST_S32(pos.x),
+ CAST_S32(pos.y));
if (sendToServer)
{
playerHandler->setDestination(
- CAST_S32(getPosition().x),
- CAST_S32(getPosition().y), -1);
+ CAST_S32(pos.x),
+ CAST_S32(pos.y), -1);
}
setAction(BeingAction::STAND);
}
@@ -1202,7 +1203,7 @@ void LocalPlayer::moveToTarget(int dist)
bool gotPos(false);
Path debugPath;
- const Vector &playerPos = getPosition();
+ const Vector &playerPos = getPixelPositionF();
unsigned int limit(0);
if (dist == -1)
@@ -1421,7 +1422,7 @@ bool LocalPlayer::isReachable(Being *const being,
return true;
}
- const Vector &playerPos = getPosition();
+ const Vector &playerPos = getPixelPositionF();
const Path debugPath = mMap->findPath(
CAST_S32(playerPos.x - mapTileSize / 2) / mapTileSize,
@@ -1966,7 +1967,7 @@ bool LocalPlayer::navigateTo(const int x, const int y)
if (!tmpLayer)
return false;
- const Vector &playerPos = getPosition();
+ const Vector &playerPos = getPixelPositionF();
mShowNavigePath = true;
mOldX = CAST_S32(playerPos.x);
mOldY = CAST_S32(playerPos.y);
@@ -2030,7 +2031,7 @@ void LocalPlayer::updateCoords()
{
Being::updateCoords();
- const Vector &playerPos = getPosition();
+ const Vector &playerPos = getPixelPositionF();
// probably map not loaded.
if (!playerPos.x || !playerPos.y)
return;
@@ -2128,7 +2129,7 @@ int LocalPlayer::getPathLength(const Being *const being) const
if (!mMap || !being)
return 0;
- const Vector &playerPos = getPosition();
+ const Vector &playerPos = getPixelPositionF();
if (being->mX == mX && being->mY == mY)
return 0;
@@ -2525,7 +2526,7 @@ void LocalPlayer::fixAttackTarget()
return;
}
- const Vector &playerPos = getPosition();
+ const Vector &playerPos = getPixelPositionF();
const Path debugPath = mMap->findPath(
CAST_S32(playerPos.x - mapTileSize / 2) / mapTileSize,
CAST_S32(playerPos.y - mapTileSize) / mapTileSize,