diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-21 22:44:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-21 22:45:15 +0300 |
commit | 42f47e483da19079a937c4801ca94bd62d8dc970 (patch) | |
tree | 56dc96737e01e04d54357ce7118de3a1f000c516 /src/being/localplayer.cpp | |
parent | 2d8b9246c8003f1d32ba396bc19cc11bc5a595b2 (diff) | |
download | plus-42f47e483da19079a937c4801ca94bd62d8dc970.tar.gz plus-42f47e483da19079a937c4801ca94bd62d8dc970.tar.bz2 plus-42f47e483da19079a937c4801ca94bd62d8dc970.tar.xz plus-42f47e483da19079a937c4801ca94bd62d8dc970.zip |
Remove useless else.
Diffstat (limited to 'src/being/localplayer.cpp')
-rw-r--r-- | src/being/localplayer.cpp | 66 |
1 files changed, 28 insertions, 38 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 44cc015d9..375b31aea 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -979,17 +979,15 @@ int LocalPlayer::getAttackRange() const { return mAttackRange; } - else + + const Item *const weapon = PlayerInfo::getEquipment( + EquipSlot::FIGHT1_SLOT); + if (weapon != nullptr) { - const Item *const weapon = PlayerInfo::getEquipment( - EquipSlot::FIGHT1_SLOT); - if (weapon != nullptr) - { - const ItemInfo &info = weapon->getInfo(); - return info.getAttackRange(); - } - return 48; // unarmed range + const ItemInfo &info = weapon->getInfo(); + return info.getAttackRange(); } + return 48; // unarmed range } bool LocalPlayer::withinAttackRange(const Being *const target, @@ -1521,11 +1519,8 @@ bool LocalPlayer::isReachable(Being *const being, being->setReachable(Reachable::REACH_YES); return true; } - else - { - being->setReachable(Reachable::REACH_NO); - return false; - } + being->setReachable(Reachable::REACH_NO); + return false; } bool LocalPlayer::isReachable(const int x, const int y, @@ -2170,26 +2165,23 @@ void LocalPlayer::updateCoords() navigateClean(); return; } - else + for (Path::const_iterator i = mNavigatePath.begin(), + i_fend = mNavigatePath.end(); + i != i_fend; + ++i) { - for (Path::const_iterator i = mNavigatePath.begin(), - i_fend = mNavigatePath.end(); - i != i_fend; - ++i) - { - if ((*i).x == mX && (*i).y == mY) - { - mNavigatePath.pop_front(); - fixPos(); - break; - } - } - if (mDrawPath && mShowNavigePath) + if ((*i).x == mX && (*i).y == mY) { - tmpLayer->clean(); - tmpLayer->addRoad(mNavigatePath); + mNavigatePath.pop_front(); + fixPos(); + break; } } + if (mDrawPath && mShowNavigePath) + { + tmpLayer->clean(); + tmpLayer->addRoad(mNavigatePath); + } } mOldX = mPixelX; mOldY = mPixelY; @@ -2241,14 +2233,12 @@ int LocalPlayer::getPathLength(const Being *const being) const 0); return CAST_S32(debugPath.size()); } - else - { - const int dx = CAST_S32(abs(being->mX - mX)); - const int dy = CAST_S32(abs(being->mY - mY)); - if (dx > dy) - return dx; - return dy; - } + + const int dx = CAST_S32(abs(being->mX - mX)); + const int dy = CAST_S32(abs(being->mY - mY)); + if (dx > dy) + return dx; + return dy; } int LocalPlayer::getAttackRange2() const |