summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-21 22:44:29 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-21 22:45:15 +0300
commit42f47e483da19079a937c4801ca94bd62d8dc970 (patch)
tree56dc96737e01e04d54357ce7118de3a1f000c516 /src/being
parent2d8b9246c8003f1d32ba396bc19cc11bc5a595b2 (diff)
downloadManaVerse-42f47e483da19079a937c4801ca94bd62d8dc970.tar.gz
ManaVerse-42f47e483da19079a937c4801ca94bd62d8dc970.tar.bz2
ManaVerse-42f47e483da19079a937c4801ca94bd62d8dc970.tar.xz
ManaVerse-42f47e483da19079a937c4801ca94bd62d8dc970.zip
Remove useless else.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp16
-rw-r--r--src/being/compoundsprite.cpp3
-rw-r--r--src/being/flooritem.cpp6
-rw-r--r--src/being/localplayer.cpp66
-rw-r--r--src/being/playerinfo.cpp18
-rw-r--r--src/being/playerrelations.cpp53
6 files changed, 66 insertions, 96 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 009690a94..89fc9bfd1 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1492,13 +1492,10 @@ std::string Being::getStandAction() const restrict2
else
return SpriteAction::DEAD;
}
- else
- {
- if ((mask & BlockMask::AIR) != 0)
- return SpriteAction::STANDSKY;
- else if ((mask & BlockMask::WATER) != 0)
- return SpriteAction::STANDWATER;
- }
+ if ((mask & BlockMask::AIR) != 0)
+ return SpriteAction::STANDSKY;
+ else if ((mask & BlockMask::WATER) != 0)
+ return SpriteAction::STANDWATER;
}
return SpriteAction::STAND;
}
@@ -2170,10 +2167,7 @@ void Being::moveBotTo(int dstX,
mercenaryHandler->move(dstX, dstY);
return;
}
- else
- {
- updateBotDirection(dstX, dstY);
- }
+ updateBotDirection(dstX, dstY);
}
void Being::updateBotDirection(const int dstX,
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index c0b81e715..a32b7db1b 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -244,8 +244,7 @@ int CompoundSprite::getNumberOfLayers() const
{
if ((mImage != nullptr) || (mAlphaImage != nullptr))
return 1;
- else
- return CAST_S32(mSprites.size());
+ return CAST_S32(mSprites.size());
}
unsigned int CompoundSprite::getCurrentFrame() const
diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp
index 3ee4a9d51..545bae892 100644
--- a/src/being/flooritem.cpp
+++ b/src/being/flooritem.cpp
@@ -148,11 +148,9 @@ std::string FloorItem::getName() const
{
return info.getName();
}
- else
#endif // TMWA_SUPPORT
- {
- return info.getName(mColor);
- }
+
+ return info.getName(mColor);
}
void FloorItem::draw(Graphics *const graphics,
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
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index 9f1514243..33541a465 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -92,8 +92,7 @@ int getAttribute(const AttributesT id)
const AtrIntMap::const_iterator it = mData.mAttributes.find(id);
if (it != mData.mAttributes.end())
return it->second;
- else
- return 0;
+ return 0;
}
void setAttribute(const AttributesT id,
@@ -111,8 +110,7 @@ int getSkillLevel(const int id)
const IntMap::const_iterator it = mData.mSkills.find(id);
if (it != mData.mSkills.end())
return it->second;
- else
- return 0;
+ return 0;
}
void setSkillLevel(const int id, const int value)
@@ -127,8 +125,7 @@ int getStatBase(const AttributesT id)
const StatMap::const_iterator it = mData.mStats.find(id);
if (it != mData.mStats.end())
return it->second.base;
- else
- return 0;
+ return 0;
}
void setStatBase(const AttributesT id, const int value, const Notify notify)
@@ -144,8 +141,7 @@ int getStatMod(const AttributesT id)
const StatMap::const_iterator it = mData.mStats.find(id);
if (it != mData.mStats.end())
return it->second.mod;
- else
- return 0;
+ return 0;
}
void setStatMod(const AttributesT id, const int value, const Notify notify)
@@ -161,8 +157,7 @@ int getStatEffective(const AttributesT id)
const StatMap::const_iterator it = mData.mStats.find(id);
if (it != mData.mStats.end())
return it->second.base + it->second.mod;
- else
- return 0;
+ return 0;
}
const std::pair<int, int> getStatExperience(const AttributesT id)
@@ -233,8 +228,7 @@ const Item *getEquipment(const unsigned int slot)
{
if (mEquipment != nullptr)
return mEquipment->getEquipment(slot);
- else
- return nullptr;
+ return nullptr;
}
void setEquipmentBackend(Equipment::Backend *const backend)
diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp
index f7a8685e6..a1e9a457c 100644
--- a/src/being/playerrelations.cpp
+++ b/src/being/playerrelations.cpp
@@ -282,34 +282,32 @@ unsigned int PlayerRelationsManager::checkPermissionSilently(
{
return mDefaultPermissions & flags;
}
- else
- {
- const PlayerRelation *const r = (*it).second;
- unsigned int permissions = PlayerRelation::RELATION_PERMISSIONS[
- CAST_S32(r->mRelation)];
- switch (r->mRelation)
- {
- case Relation::NEUTRAL:
- permissions = mDefaultPermissions;
- break;
-
- case Relation::FRIEND:
- permissions |= mDefaultPermissions; // widen
- break;
-
- case Relation::DISREGARDED:
- case Relation::IGNORED:
- case Relation::ERASED:
- case Relation::BLACKLISTED:
- case Relation::ENEMY2:
- default:
- permissions &= mDefaultPermissions; // narrow
- break;
- }
+ const PlayerRelation *const r = (*it).second;
+ unsigned int permissions = PlayerRelation::RELATION_PERMISSIONS[
+ CAST_S32(r->mRelation)];
- return permissions & flags;
+ switch (r->mRelation)
+ {
+ case Relation::NEUTRAL:
+ permissions = mDefaultPermissions;
+ break;
+
+ case Relation::FRIEND:
+ permissions |= mDefaultPermissions; // widen
+ break;
+
+ case Relation::DISREGARDED:
+ case Relation::IGNORED:
+ case Relation::ERASED:
+ case Relation::BLACKLISTED:
+ case Relation::ENEMY2:
+ default:
+ permissions &= mDefaultPermissions; // narrow
+ break;
}
+
+ return permissions & flags;
}
bool PlayerRelationsManager::hasPermission(const Being *const being,
@@ -455,10 +453,7 @@ void PlayerRelationsManager::ignoreTrade(const std::string &name) const
{
return;
}
- else
- {
- playerRelations.setRelation(name, Relation::BLACKLISTED);
- }
+ playerRelations.setRelation(name, Relation::BLACKLISTED);
}
bool PlayerRelationsManager::checkBadRelation(const std::string &name) const