diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-05 16:07:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-05 16:07:44 +0300 |
commit | 8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d (patch) | |
tree | 5cc8d0097ce680cca550216e2313d1d1cb550cfc /src/being | |
parent | 3aaf10f021303dd67a2c36bf23f380348b5bdf02 (diff) | |
download | plus-8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d.tar.gz plus-8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d.tar.bz2 plus-8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d.tar.xz plus-8480ff2ce8ac1ce1ceba024eddfaeb62a5d20f8d.zip |
Rename walkMask into blockWalkMask.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/being.cpp | 16 | ||||
-rw-r--r-- | src/being/being.h | 4 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 44 | ||||
-rw-r--r-- | src/being/localplayer.h | 2 |
4 files changed, 33 insertions, 33 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index f45fa4ec8..a47738868 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -387,7 +387,7 @@ void Being::setDestination(const int dstX, const int dstY) if (!mMap) return; - setPath(mMap->findPath(mX, mY, dstX, dstY, getWalkMask())); + setPath(mMap->findPath(mX, mY, dstX, dstY, getBlockWalkMask())); } void Being::clearPath() @@ -1336,7 +1336,7 @@ void Being::nextTile() if (dir) setDirection(dir); - if (!mMap || !mMap->getWalk(pos.x, pos.y, getWalkMask())) + if (!mMap || !mMap->getWalk(pos.x, pos.y, getBlockWalkMask())) { setAction(BeingAction::STAND, 0); return; @@ -1560,25 +1560,25 @@ void Being::petLogic() } } - const unsigned char walkMask = getWalkMask(); - if (!mMap->getWalk(dstX, dstY, walkMask)) + const unsigned char blockWalkMask = getBlockWalkMask(); + if (!mMap->getWalk(dstX, dstY, blockWalkMask)) { if (dstX != dstX0) { dstX = dstX0; - if (!mMap->getWalk(dstX, dstY, walkMask)) + if (!mMap->getWalk(dstX, dstY, blockWalkMask)) dstY = dstY0; } else if (dstY != dstY0) { dstY = dstY0; - if (!mMap->getWalk(dstX, dstY, walkMask)) + if (!mMap->getWalk(dstX, dstY, blockWalkMask)) dstX = dstX0; } } if (mX != dstX || mY != dstY) { - setPath(mMap->findPath(mX, mY, dstX, dstY, walkMask)); + setPath(mMap->findPath(mX, mY, dstX, dstY, blockWalkMask)); Net::getPetHandler()->move(mOwner, mId, mX, mY, dstX, dstY); return; } @@ -3278,7 +3278,7 @@ void Being::fixPetSpawnPos(int &dstX, int &dstY) const dstY += offsetY; if (mMap) { - if (!mMap->getWalk(dstX, dstY, getWalkMask())) + if (!mMap->getWalk(dstX, dstY, getBlockWalkMask())) { dstX = mOwner->getTileX(); dstY = mOwner->getTileY(); diff --git a/src/being/being.h b/src/being/being.h index 929ebf8d9..c50cdf871 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -412,11 +412,11 @@ class Being notfinal : public ActorSprite, /** * Gets the way the object is blocked by other objects. */ - virtual unsigned char getWalkMask() const A_WARN_UNUSED + virtual unsigned char getBlockWalkMask() const A_WARN_UNUSED { if (!mInfo) return 0; - return mInfo->getWalkMask(); + return mInfo->getBlockWalkMask(); } /** diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 55859ae69..446deec36 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -490,7 +490,7 @@ bool LocalPlayer::pickUp(FloorItem *const item) const Path debugPath = mMap->findPath( static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, - item->getTileX(), item->getTileY(), getWalkMask(), 0); + item->getTileX(), item->getTileY(), getBlockWalkMask(), 0); if (!debugPath.empty()) navigateTo(item->getTileX(), item->getTileY()); else @@ -623,19 +623,19 @@ void LocalPlayer::startWalking(const unsigned char dir) if (dir & BeingDirection::RIGHT) dx++; - const unsigned char walkMask = getWalkMask(); + const unsigned char blockWalkMask = getBlockWalkMask(); // Prevent skipping corners over colliding tiles - if (dx && !mMap->getWalk(mX + dx, mY, walkMask)) + if (dx && !mMap->getWalk(mX + dx, mY, blockWalkMask)) dx = 0; - if (dy && !mMap->getWalk(mX, mY + dy, walkMask)) + if (dy && !mMap->getWalk(mX, mY + dy, blockWalkMask)) dy = 0; // Choose a straight direction when diagonal target is blocked - if (dx && dy && !mMap->getWalk(mX + dx, mY + dy, walkMask)) + if (dx && dy && !mMap->getWalk(mX + dx, mY + dy, blockWalkMask)) dx = 0; // Walk to where the player can actually go - if ((dx || dy) && mMap->getWalk(mX + dx, mY + dy, walkMask)) + if ((dx || dy) && mMap->getWalk(mX + dx, mY + dy, blockWalkMask)) { setDestination(mX + dx, mY + dy); } @@ -1148,7 +1148,7 @@ void LocalPlayer::moveToTarget(int dist) debugPath = mMap->findPath(static_cast<int>( playerPos.x - mapTileSize / 2) / mapTileSize, static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, - mTarget->getTileX(), mTarget->getTileY(), getWalkMask(), 0); + mTarget->getTileX(), mTarget->getTileY(), getBlockWalkMask(), 0); } const size_t sz = debugPath.size(); @@ -1599,46 +1599,46 @@ void LocalPlayer::crazyMove8() int mult = 1; - const unsigned char walkMask = getWalkMask(); + const unsigned char blockWalkMask = getBlockWalkMask(); if (mMap->getWalk(mX + movesX[idx][0], - mY + movesY[idx][0], walkMask)) + mY + movesY[idx][0], blockWalkMask)) { while (mMap->getWalk(mX + movesX[idx][0] * mult, mY + movesY[idx][0] * mult, - getWalkMask()) && mult <= dist) + getBlockWalkMask()) && mult <= dist) { mult ++; } move(movesX[idx][0] * (mult - 1), movesY[idx][0] * (mult - 1)); } else if (mMap->getWalk(mX + movesX[idx][1], - mY + movesY[idx][1], walkMask)) + mY + movesY[idx][1], blockWalkMask)) { while (mMap->getWalk(mX + movesX[idx][1] * mult, mY + movesY[idx][1] * mult, - getWalkMask()) && mult <= dist) + getBlockWalkMask()) && mult <= dist) { mult ++; } move(movesX[idx][1] * (mult - 1), movesY[idx][1] * (mult - 1)); } else if (mMap->getWalk(mX + movesX[idx][2], - mY + movesY[idx][2], walkMask)) + mY + movesY[idx][2], blockWalkMask)) { while (mMap->getWalk(mX + movesX[idx][2] * mult, mY + movesY[idx][2] * mult, - getWalkMask()) && mult <= dist) + getBlockWalkMask()) && mult <= dist) { mult ++; } move(movesX[idx][2] * (mult - 1), movesY[idx][2] * (mult - 1)); } else if (mMap->getWalk(mX + movesX[idx][3], - mY + movesY[idx][3], walkMask)) + mY + movesY[idx][3], blockWalkMask)) { while (mMap->getWalk(mX + movesX[idx][3] * mult, mY + movesY[idx][3] * mult, - getWalkMask()) && mult <= dist) + getBlockWalkMask()) && mult <= dist) { mult ++; } @@ -2009,7 +2009,7 @@ bool LocalPlayer::isReachable(Being *const being, const Path debugPath = mMap->findPath( static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, - being->getTileX(), being->getTileY(), getWalkMask(), maxCost); + being->getTileX(), being->getTileY(), getBlockWalkMask(), maxCost); being->setDistance(static_cast<int>(debugPath.size())); if (!debugPath.empty()) @@ -2557,7 +2557,7 @@ bool LocalPlayer::navigateTo(const int x, const int y) mNavigatePath = mMap->findPath( static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, - x, y, getWalkMask(), 0); + x, y, getBlockWalkMask(), 0); if (mDrawPath) tmpLayer->addRoad(mNavigatePath); @@ -2586,7 +2586,7 @@ void LocalPlayer::navigateTo(const Being *const being) static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, being->getTileX(), being->getTileY(), - getWalkMask(), 0); + getBlockWalkMask(), 0); if (mDrawPath) tmpLayer->addRoad(mNavigatePath); @@ -2751,7 +2751,7 @@ int LocalPlayer::getPathLength(const Being *const being) const static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, being->getTileX(), being->getTileY(), - getWalkMask(), 0); + getBlockWalkMask(), 0); return static_cast<int>(debugPath.size()); } else @@ -3126,7 +3126,7 @@ void LocalPlayer::fixAttackTarget() static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, mTarget->getTileX(), mTarget->getTileY(), - getWalkMask(), 0); + getBlockWalkMask(), 0); if (!debugPath.empty()) { @@ -3208,7 +3208,7 @@ void LocalPlayer::checkNewName(Being *const being) } } -unsigned char LocalPlayer::getWalkMask() const +unsigned char LocalPlayer::getBlockWalkMask() const { // for now blocking all types of collisions return BlockMask::WALL | BlockMask::AIR | BlockMask::WATER; diff --git a/src/being/localplayer.h b/src/being/localplayer.h index c27b04f47..63d122f44 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -366,7 +366,7 @@ class LocalPlayer final : public Being, void checkNewName(Being *const being); - unsigned char getWalkMask() const override final A_WARN_UNUSED; + unsigned char getBlockWalkMask() const override final A_WARN_UNUSED; void saveHomes(); |