summaryrefslogtreecommitdiff
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
parent2d8b9246c8003f1d32ba396bc19cc11bc5a595b2 (diff)
downloadManaVerse-42f47e483da19079a937c4801ca94bd62d8dc970.tar.gz
ManaVerse-42f47e483da19079a937c4801ca94bd62d8dc970.tar.bz2
ManaVerse-42f47e483da19079a937c4801ca94bd62d8dc970.tar.xz
ManaVerse-42f47e483da19079a937c4801ca94bd62d8dc970.zip
Remove useless else.
-rw-r--r--src/actions/commands.cpp5
-rw-r--r--src/actormanager.cpp218
-rw-r--r--src/avatar.cpp10
-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
-rw-r--r--src/configuration.cpp8
-rw-r--r--src/fs/paths.cpp8
-rw-r--r--src/gamemodifiers.cpp5
-rw-r--r--src/gui/dialogsmanager.cpp21
-rw-r--r--src/gui/fonts/font.cpp3
-rw-r--r--src/gui/gui.cpp3
-rw-r--r--src/gui/models/playertablemodel.cpp6
-rw-r--r--src/gui/models/skillmodel.cpp3
-rw-r--r--src/gui/models/worldlistmodel.h5
-rw-r--r--src/gui/popups/popupmenu.cpp3
-rw-r--r--src/gui/skin.h6
-rw-r--r--src/gui/theme.cpp5
-rw-r--r--src/gui/viewport.cpp106
-rw-r--r--src/gui/widgets/attrs/attrdisplay.h3
-rw-r--r--src/gui/widgets/button.cpp3
-rw-r--r--src/gui/widgets/guitable.cpp13
-rw-r--r--src/gui/widgets/itemcontainer.cpp3
-rw-r--r--src/gui/widgets/setupitem.cpp3
-rw-r--r--src/gui/widgets/tabbedarea.cpp9
-rw-r--r--src/gui/widgets/textbox.cpp6
-rw-r--r--src/gui/widgets/widget2.h3
-rw-r--r--src/gui/windows/chatwindow.cpp11
-rw-r--r--src/gui/windows/emotewindow.cpp3
-rw-r--r--src/gui/windows/socialwindow.cpp5
-rw-r--r--src/gui/windows/tradewindow.cpp9
-rw-r--r--src/gui/windows/whoisonline.cpp7
-rw-r--r--src/guild.cpp3
-rw-r--r--src/net/ea/equipbackend.h3
-rw-r--r--src/net/eathena/partyhandler.cpp5
-rw-r--r--src/net/ipc.cpp6
-rw-r--r--src/net/packetlimiter.cpp14
-rw-r--r--src/net/tmwa/guildmanager.cpp57
-rw-r--r--src/resources/animation/simpleanimation.cpp3
-rw-r--r--src/resources/beinginfo.cpp5
-rw-r--r--src/resources/chatobject.cpp6
-rw-r--r--src/resources/db/avatardb.cpp3
-rw-r--r--src/resources/db/colordb.cpp5
-rw-r--r--src/resources/db/elementaldb.cpp9
-rw-r--r--src/resources/db/emotedb.cpp10
-rw-r--r--src/resources/db/homunculusdb.cpp9
-rw-r--r--src/resources/db/horsedb.cpp5
-rw-r--r--src/resources/db/mercenarydb.cpp9
-rw-r--r--src/resources/db/moddb.cpp3
-rw-r--r--src/resources/db/monsterdb.cpp9
-rw-r--r--src/resources/db/npcdb.cpp5
-rw-r--r--src/resources/db/palettedb.cpp3
-rw-r--r--src/resources/db/petdb.cpp5
-rw-r--r--src/resources/db/skillunitdb.cpp5
-rw-r--r--src/resources/db/unitsdb.cpp102
-rw-r--r--src/resources/image/image.cpp9
-rw-r--r--src/resources/image/subimage.cpp3
-rw-r--r--src/resources/imageset.cpp5
-rw-r--r--src/resources/item/item.cpp5
-rw-r--r--src/resources/iteminfo.cpp25
-rw-r--r--src/resources/loaders/musicloader.cpp8
-rw-r--r--src/resources/loaders/soundloader.cpp9
-rw-r--r--src/resources/map/map.cpp3
-rw-r--r--src/resources/sdlmusic.cpp3
-rw-r--r--src/resources/sprite/animatedsprite.cpp9
-rw-r--r--src/resources/sprite/spritedef.cpp3
-rw-r--r--src/resources/wallpaper.cpp3
-rw-r--r--src/statuseffect.cpp20
-rw-r--r--src/utils/stringutils.cpp48
-rw-r--r--src/utils/timer.cpp10
-rw-r--r--src/utils/translation/poparser.cpp48
74 files changed, 456 insertions, 694 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index af7fecf23..a415a2117 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -227,10 +227,7 @@ impHandler(chatErase)
}
return true;
}
- else
- {
- playerRelations.setRelation(args, Relation::ERASED);
- }
+ playerRelations.setRelation(args, Relation::ERASED);
reportRelation(event,
Relation::ERASED,
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index c864b8c08..2649cb230 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -541,40 +541,37 @@ Being *ActorManager::findBeingByPixel(const int x, const int y,
return nullptr;
return tempBeing;
}
- else
+ for_actorsm
{
- for_actorsm
- {
// disabled for performance
// if (reportTrue(*it == nullptr))
// continue;
- if ((*it)->getType() == ActorType::Portal ||
- (*it)->getType() == ActorType::FloorItem)
- {
- continue;
- }
+ if ((*it)->getType() == ActorType::Portal ||
+ (*it)->getType() == ActorType::FloorItem)
+ {
+ continue;
+ }
- Being *const being = static_cast<Being*>(*it);
+ Being *const being = static_cast<Being*>(*it);
- if (being->getInfo() != nullptr &&
- !(being->getInfo()->isTargetSelection() || modActive))
- {
- continue;
- }
+ if (being->getInfo() != nullptr &&
+ !(being->getInfo()->isTargetSelection() || modActive))
+ {
+ continue;
+ }
- const int px = being->getPixelX();
- const int py = being->getPixelY();
- if ((px - mapTileSize / 2 <= x) &&
- (px + mapTileSize / 2 > x) &&
- (py - mapTileSize <= y) &&
- (py > y))
- {
- return being;
- }
+ const int px = being->getPixelX();
+ const int py = being->getPixelY();
+ if ((px - mapTileSize / 2 <= x) &&
+ (px + mapTileSize / 2 > x) &&
+ (py - mapTileSize <= y) &&
+ (py > y))
+ {
+ return being;
}
- return nullptr;
}
+ return nullptr;
}
void ActorManager::findBeingsByPixel(STD_VECTOR<ActorSprite*> &beings,
@@ -922,17 +919,14 @@ Being *ActorManager::findNearestByName(const std::string &name,
{
return being;
}
- else
- {
- const int d = (being->getTileX() - x) * (being->getTileX() - x)
- + (being->getTileY() - y) * (being->getTileY() - y);
+ const int d = (being->getTileX() - x) * (being->getTileX() - x)
+ + (being->getTileY() - y) * (being->getTileY() - y);
- if (validateBeing(nullptr, being, type, nullptr, 50)
- && (d < dist || closestBeing == nullptr))
- {
- dist = d;
- closestBeing = being;
- }
+ if (validateBeing(nullptr, being, type, nullptr, 50)
+ && (d < dist || closestBeing == nullptr))
+ {
+ dist = d;
+ closestBeing = being;
}
}
}
@@ -1277,115 +1271,113 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing,
// we find next being after target
return *i;
}
- else
- {
- int dist = 0;
- int index = defaultPriorityIndex;
- Being *closestBeing = nullptr;
- FOR_EACH (ActorSprites::iterator, i, mActors)
- {
+ int dist = 0;
+ int index = defaultPriorityIndex;
+ Being *closestBeing = nullptr;
+
+ FOR_EACH (ActorSprites::iterator, i, mActors)
+ {
// disabled for performance
// if (reportTrue(*i == nullptr))
// continue;
- if ((*i)->getType() == ActorType::FloorItem ||
- (*i)->getType() == ActorType::Portal)
- {
- continue;
- }
- Being *const being = static_cast<Being*>(*i);
+ if ((*i)->getType() == ActorType::FloorItem ||
+ (*i)->getType() == ActorType::Portal)
+ {
+ continue;
+ }
+ Being *const being = static_cast<Being*>(*i);
- if (filtered)
+ if (filtered)
+ {
+ if (ignoreAttackMobs.find(being->getName())
+ != ignoreAttackMobs.end())
{
- if (ignoreAttackMobs.find(being->getName())
- != ignoreAttackMobs.end())
- {
- continue;
- }
- if (ignoreDefault && attackMobs.find(being->getName())
- == attackMobs.end() && priorityMobs.find(being->getName())
- == priorityMobs.end())
- {
- continue;
- }
+ continue;
}
-
- if ((being->getInfo() != nullptr)
- && !(being->getInfo()->isTargetSelection() || modActive))
+ if (ignoreDefault && attackMobs.find(being->getName())
+ == attackMobs.end() && priorityMobs.find(being->getName())
+ == priorityMobs.end())
{
continue;
}
+ }
+
+ if ((being->getInfo() != nullptr)
+ && !(being->getInfo()->isTargetSelection() || modActive))
+ {
+ continue;
+ }
- const bool valid = validateBeing(aroundBeing, being,
+ const bool valid = validateBeing(aroundBeing, being,
type, excluded, 50);
- int d = being->getDistance();
- if (being->getType() != ActorType::Monster
- || !mTargetOnlyReachable)
- { // if distance not calculated, use old distance
- d = (being->getTileX() - x) * (being->getTileX() - x)
- + (being->getTileY() - y) * (being->getTileY() - y);
- }
+ int d = being->getDistance();
+ if (being->getType() != ActorType::Monster
+ || !mTargetOnlyReachable)
+ { // if distance not calculated, use old distance
+ d = (being->getTileX() - x) * (being->getTileX() - x)
+ + (being->getTileY() - y) * (being->getTileY() - y);
+ }
- if (!valid)
- continue;
+ if (!valid)
+ continue;
- if (specialDistance && being->getDistance() <= 2
- && being->getType() == type)
- {
- continue;
- }
+ if (specialDistance && being->getDistance() <= 2
+ && being->getType() == type)
+ {
+ continue;
+ }
// logger->log("being name:" + being->getName());
// logger->log("index:" + toString(index));
// logger->log("d:" + toString(d));
- if (!filtered && (d <= dist || (closestBeing == nullptr)))
- {
- dist = d;
- closestBeing = being;
- }
- else if (filtered)
+ if (!filtered && (d <= dist || (closestBeing == nullptr)))
+ {
+ dist = d;
+ closestBeing = being;
+ }
+ else if (filtered)
+ {
+ int w2 = defaultPriorityIndex;
+ if (closestBeing != nullptr)
{
- int w2 = defaultPriorityIndex;
- if (closestBeing != nullptr)
- {
- const StringIntMapCIter it2 = priorityMobsMap.find(
- being->getName());
- if (it2 != priorityMobsMap.end())
- w2 = (*it2).second;
+ const StringIntMapCIter it2 = priorityMobsMap.find(
+ being->getName());
+ if (it2 != priorityMobsMap.end())
+ w2 = (*it2).second;
- if (w2 < index)
- {
- dist = d;
- closestBeing = being;
- index = w2;
- continue;
- }
- if (w2 == index && d <= dist)
- {
- dist = d;
- closestBeing = being;
- index = w2;
- continue;
- }
+ if (w2 < index)
+ {
+ dist = d;
+ closestBeing = being;
+ index = w2;
+ continue;
}
-
- if (closestBeing == nullptr)
+ if (w2 == index && d <= dist)
{
dist = d;
closestBeing = being;
- const StringIntMapCIter it1 = priorityMobsMap.find(
- being->getName());
- if (it1 != priorityMobsMap.end())
- index = (*it1).second;
- else
- index = defaultPriorityIndex;
+ index = w2;
+ continue;
}
}
+
+ if (closestBeing == nullptr)
+ {
+ dist = d;
+ closestBeing = being;
+ const StringIntMapCIter it1 = priorityMobsMap.find(
+ being->getName());
+ if (it1 != priorityMobsMap.end())
+ index = (*it1).second;
+ else
+ index = defaultPriorityIndex;
+ }
}
- return (maxDist >= dist) ? closestBeing : nullptr;
}
+ return (maxDist >= dist) ? closestBeing : nullptr;
}
bool ActorManager::validateBeing(const Being *const aroundBeing,
diff --git a/src/avatar.cpp b/src/avatar.cpp
index aa6618603..e3975a3d7 100644
--- a/src/avatar.cpp
+++ b/src/avatar.cpp
@@ -54,17 +54,13 @@ std::string Avatar::getComplexName() const
{
return mName;
}
- else
- {
- return std::string(mName).append("(").append(
- mOriginalName).append(")");
- }
+ return std::string(mName).append("(").append(
+ mOriginalName).append(")");
}
std::string Avatar::getAdditionString() const
{
if (!getIp().empty())
return " - " + getIp();
- else
- return "";
+ return "";
}
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
diff --git a/src/configuration.cpp b/src/configuration.cpp
index bc872b4d5..6e42304f6 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -297,8 +297,7 @@ bool ConfigurationObject::getValueBool(const std::string &key,
const Options::const_iterator iter = mOptions.find(key);
if (iter != mOptions.end())
return atoi(iter->second.c_str()) != 0 ? true : false;
- else
- return deflt;
+ return deflt;
}
unsigned ConfigurationObject::getValue(const std::string &key,
@@ -887,10 +886,7 @@ void Configuration::write()
BLOCK_END("Configuration::write")
return;
}
- else
- {
- fclose(testFile);
- }
+ fclose(testFile);
XmlTextWriterPtr writer = XmlNewTextWriterFilename(
mConfigPath.c_str(), 0);
diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp
index b53736024..4eaf6ac60 100644
--- a/src/fs/paths.cpp
+++ b/src/fs/paths.cpp
@@ -146,8 +146,7 @@ std::string removeLast(const std::string &str)
}
if (pos2 != std::string::npos)
return str.substr(0, pos2);
- else
- return str;
+ return str;
}
#ifdef WIN32
@@ -173,10 +172,7 @@ std::string getSelfName()
buf[sz] = 0;
return buf;
}
- else
- {
- return "";
- }
+ return "";
}
#else // WIN32
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index 13a92f082..bed509dae 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -292,10 +292,7 @@ std::string GameModifiers::getQuickDropCounterString()
return strprintf("(%c) drop counter %u", CAST_S8(
'a' + cnt - 10), cnt);
}
- else
- {
- return strprintf("(%u) drop counter %u", cnt, cnt);
- }
+ return strprintf("(%u) drop counter %u", cnt, cnt);
}
void GameModifiers::setQuickDropCounter(const int n)
diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp
index 9b2335736..979db937d 100644
--- a/src/gui/dialogsmanager.cpp
+++ b/src/gui/dialogsmanager.cpp
@@ -122,18 +122,15 @@ Window *DialogsManager::openErrorDialog(const std::string &header,
260);
return dialog;
}
- else
- {
- ConfirmDialog *const dialog = CREATEWIDGETR(ConfirmDialog,
- header,
- strprintf("%s %s", message.c_str(),
- // TRANSLATORS: error message question
- _("Do you want to open support page?")),
- SOUND_ERROR,
- false,
- modal);
- return dialog;
- }
+ ConfirmDialog *const dialog = CREATEWIDGETR(ConfirmDialog,
+ header,
+ strprintf("%s %s", message.c_str(),
+ // TRANSLATORS: error message question
+ _("Do you want to open support page?")),
+ SOUND_ERROR,
+ false,
+ modal);
+ return dialog;
}
void DialogsManager::playerDeath()
diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp
index 78c243a70..a2919481c 100644
--- a/src/gui/fonts/font.cpp
+++ b/src/gui/fonts/font.cpp
@@ -347,8 +347,7 @@ int Font::getWidth(const std::string &text) const
const Image *const image = chunk->img;
if (image != nullptr)
return image->getWidth();
- else
- return 0;
+ return 0;
}
// if string was not drawed
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c27aeec35..67735e2a6 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -388,8 +388,7 @@ bool Gui::handleInput()
{
if (mInput != nullptr)
return handleKeyInput();
- else
- return false;
+ return false;
}
bool Gui::handleKeyInput()
diff --git a/src/gui/models/playertablemodel.cpp b/src/gui/models/playertablemodel.cpp
index 417fafcbc..271b6a5bb 100644
--- a/src/gui/models/playertablemodel.cpp
+++ b/src/gui/models/playertablemodel.cpp
@@ -68,8 +68,7 @@ int PlayerTableModel::getRows() const
{
if (mPlayers != nullptr)
return CAST_S32(mPlayers->size());
- else
- return 0;
+ return 0;
}
int PlayerTableModel::getColumns() const
@@ -86,8 +85,7 @@ int PlayerTableModel::getColumnWidth(const int index) const
{
if (index == NAME_COLUMN)
return NAME_COLUMN_WIDTH;
- else
- return RELATION_CHOICE_COLUMN_WIDTH;
+ return RELATION_CHOICE_COLUMN_WIDTH;
}
void PlayerTableModel::playerRelationsUpdated()
diff --git a/src/gui/models/skillmodel.cpp b/src/gui/models/skillmodel.cpp
index 0dcf9cedd..4d22280d8 100644
--- a/src/gui/models/skillmodel.cpp
+++ b/src/gui/models/skillmodel.cpp
@@ -47,8 +47,7 @@ std::string SkillModel::getElementAt(int i)
const SkillInfo *const info = getSkillAt(i);
if (info != nullptr)
return info->data->name;
- else
- return std::string();
+ return std::string();
}
void SkillModel::updateVisibilities()
diff --git a/src/gui/models/worldlistmodel.h b/src/gui/models/worldlistmodel.h
index 9ae5a5e22..3be179c61 100644
--- a/src/gui/models/worldlistmodel.h
+++ b/src/gui/models/worldlistmodel.h
@@ -59,10 +59,7 @@ class WorldListModel final : public ListModel
return std::string(si->name).append(" (").append(
toString(si->online_users)).append(")");
}
- else
- {
- return "???";
- }
+ return "???";
}
private:
Worlds mWorlds;
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 18d2fd236..2ba797bf9 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -195,8 +195,7 @@ bool PopupMenu::isAllowOtherCommand(const ServerCommandTypeT command)
mGroup->mCommands[CAST_SIZE(command)];
if (mName == localPlayer->getName())
return (enabled & ServerCommandEnable::Self) != 0;
- else
- return (enabled & ServerCommandEnable::Other) != 0;
+ return (enabled & ServerCommandEnable::Other) != 0;
}
void PopupMenu::showPopup(const int x, const int y, const Being *const being)
diff --git a/src/gui/skin.h b/src/gui/skin.h
index 55f2b79a7..acba303ac 100644
--- a/src/gui/skin.h
+++ b/src/gui/skin.h
@@ -106,8 +106,7 @@ class Skin final
{
if (mOptions->find(name) != mOptions->end())
return (*mOptions)[name];
- else
- return 0;
+ return 0;
}
int getOption(const std::string &name,
@@ -115,8 +114,7 @@ class Skin final
{
if (mOptions->find(name) != mOptions->end())
return (*mOptions)[name];
- else
- return def;
+ return def;
}
int instances;
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 1ce1b7e30..503c3c86a 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -71,10 +71,7 @@ static void initDefaultThemePath()
{
return;
}
- else
- {
- defaultThemePath = "themes/";
- }
+ defaultThemePath = "themes/";
}
Theme::Theme() :
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index c77232591..168ec317a 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -441,71 +441,69 @@ bool Viewport::leftMouseAction()
mHoverBeing->talkTo();
return true;
}
- else
+
+ const ActorTypeT type = mHoverBeing->getType();
+ switch (type)
{
- const ActorTypeT type = mHoverBeing->getType();
- switch (type)
- {
- case ActorType::Player:
- validateSpeed();
- if (actorManager != nullptr)
- {
+ case ActorType::Player:
+ validateSpeed();
+ if (actorManager != nullptr)
+ {
#ifdef TMWA_SUPPORT
- if (localPlayer != mHoverBeing || mSelfMouseHeal)
- actorManager->heal(mHoverBeing);
+ if (localPlayer != mHoverBeing || mSelfMouseHeal)
+ actorManager->heal(mHoverBeing);
#endif // TMWA_SUPPORT
- if (localPlayer == mHoverBeing &&
- mHoverItem != nullptr)
- {
- localPlayer->pickUp(mHoverItem);
- }
- return true;
+ if (localPlayer == mHoverBeing &&
+ mHoverItem != nullptr)
+ {
+ localPlayer->pickUp(mHoverItem);
}
- break;
- case ActorType::Monster:
- case ActorType::Npc:
- case ActorType::SkillUnit:
- if (!stopAttack)
+ return true;
+ }
+ break;
+ case ActorType::Monster:
+ case ActorType::Npc:
+ case ActorType::SkillUnit:
+ if (!stopAttack)
+ {
+ if ((localPlayer->withinAttackRange(mHoverBeing) ||
+ inputManager.isActionActive(InputAction::ATTACK)))
{
- if ((localPlayer->withinAttackRange(mHoverBeing) ||
- inputManager.isActionActive(InputAction::ATTACK)))
+ validateSpeed();
+ if (!mStatsReUpdated && localPlayer != mHoverBeing)
{
- validateSpeed();
- if (!mStatsReUpdated && localPlayer != mHoverBeing)
- {
- localPlayer->attack(mHoverBeing,
- !inputManager.isActionActive(
- InputAction::STOP_ATTACK));
- return true;
- }
+ localPlayer->attack(mHoverBeing,
+ !inputManager.isActionActive(
+ InputAction::STOP_ATTACK));
+ return true;
}
- else if (!inputManager.isActionActive(
- InputAction::ATTACK))
+ }
+ else if (!inputManager.isActionActive(
+ InputAction::ATTACK))
+ {
+ validateSpeed();
+ if (!mStatsReUpdated && localPlayer != mHoverBeing)
{
- validateSpeed();
- if (!mStatsReUpdated && localPlayer != mHoverBeing)
- {
- localPlayer->setGotoTarget(mHoverBeing);
- return true;
- }
+ localPlayer->setGotoTarget(mHoverBeing);
+ return true;
}
}
- break;
- case ActorType::FloorItem:
- case ActorType::Portal:
- case ActorType::Pet:
- case ActorType::Mercenary:
- case ActorType::Homunculus:
- case ActorType::Elemental:
- break;
- case ActorType::Unknown:
- case ActorType::Avatar:
- default:
- reportAlways("Left click on unknown actor type: %d",
- CAST_S32(type));
- break;
- }
+ }
+ break;
+ case ActorType::FloorItem:
+ case ActorType::Portal:
+ case ActorType::Pet:
+ case ActorType::Mercenary:
+ case ActorType::Homunculus:
+ case ActorType::Elemental:
+ break;
+ case ActorType::Unknown:
+ case ActorType::Avatar:
+ default:
+ reportAlways("Left click on unknown actor type: %d",
+ CAST_S32(type));
+ break;
}
}
// Picks up a item if we clicked on one
diff --git a/src/gui/widgets/attrs/attrdisplay.h b/src/gui/widgets/attrs/attrdisplay.h
index 1641bac9f..f682e41f5 100644
--- a/src/gui/widgets/attrs/attrdisplay.h
+++ b/src/gui/widgets/attrs/attrdisplay.h
@@ -56,8 +56,7 @@ class AttrDisplay notfinal : public Container
{
if (mValue == nullptr)
return "-";
- else
- return mValue->getCaption();
+ return mValue->getCaption();
}
const std::string &getShortName() const
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 3509b927c..df46014a3 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -880,8 +880,7 @@ bool Button::isPressed() const
{
if (mMousePressed)
return mHasMouse;
- else
- return mKeyPressed;
+ return mKeyPressed;
}
void Button::focusLost(const Event& event A_UNUSED)
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 9ff2075b1..4a0f88246 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -608,13 +608,10 @@ Widget *GuiTable::getWidgetAt(int x, int y)
if (row > -1 && column > -1)
{
Widget *const w = mModel->getElementAt(row, column);
- if ((w != nullptr) && w->isFocusable())
+ if (w != nullptr && w->isFocusable())
return w;
- else
- return nullptr; // Grab the event locally
}
- else
- return nullptr;
+ return nullptr;
}
int GuiTable::getRowForY(const int y) const
@@ -627,8 +624,7 @@ int GuiTable::getRowForY(const int y) const
if (row < 0 || row >= mModel->getRows())
return -1;
- else
- return row;
+ return row;
}
int GuiTable::getColumnForX(const int x) const
@@ -646,8 +642,7 @@ int GuiTable::getColumnForX(const int x) const
if (column < 0 || column >= colnum)
return -1;
- else
- return column;
+ return column;
}
void GuiTable::setFocusHandler(FocusHandler *const focusHandler)
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 4b70c86b7..3d5c3829f 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -596,8 +596,7 @@ Item *ItemContainer::getSelectedItem() const
{
if (mInventory != nullptr)
return mInventory->getItem(mSelectedIndex);
- else
- return nullptr;
+ return nullptr;
}
void ItemContainer::distributeValueChangedEvent()
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index e4b40f9be..ee19caed1 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -104,8 +104,7 @@ Configuration *SetupItem::getConfig() const
{
if (mMainConfig == MainConfig_true)
return &config;
- else
- return &serverConfig;
+ return &serverConfig;
}
void SetupItem::load()
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index ced56cea0..e89f60418 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -223,8 +223,7 @@ Widget *TabbedArea::getCurrentWidget() const
if (tab != nullptr)
return getWidget(tab->getCaption());
- else
- return nullptr;
+ return nullptr;
}
void TabbedArea::addTab(Tab *const tab,
@@ -779,9 +778,8 @@ void TabbedArea::keyPressed(KeyEvent& event)
if (index < 0)
return;
- else
- setSelectedTab(mTabs[index].first);
+ setSelectedTab(mTabs[index].first);
event.consume();
}
else if (actionId == InputAction::GUI_RIGHT)
@@ -791,9 +789,8 @@ void TabbedArea::keyPressed(KeyEvent& event)
if (index >= CAST_S32(mTabs.size()))
return;
- else
- setSelectedTab(mTabs[index].first);
+ setSelectedTab(mTabs[index].first);
event.consume();
}
}
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 31e000082..5d1696835 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -529,10 +529,8 @@ void TextBox::setCaretPosition(unsigned int position)
mCaretColumn = position;
return; // we are done
}
- else
- {
- position--;
- }
+
+ position--;
}
// position beyond end of text
diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h
index ed9110ba4..12103e317 100644
--- a/src/gui/widgets/widget2.h
+++ b/src/gui/widgets/widget2.h
@@ -57,8 +57,7 @@ class Widget2 notfinal
const ThemeColorIdT colorId = theme->getIdByChar(c, valid);
if (valid)
return theme->getColor(colorId + mPaletteOffset, 255U);
- else
- return Palette::BLACK;
+ return Palette::BLACK;
}
virtual void setWidget2(const Widget2 *const widget)
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 7992c6262..a3032de54 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -878,10 +878,8 @@ void ChatWindow::keyPressed(KeyEvent &event)
mChatInput->setCaretPosition(0);
return;
}
- else
- {
- mChatHistoryIndex --;
- }
+
+ mChatHistoryIndex --;
unsigned int f = 0;
const std::list<std::string> &rows = tab->getRows();
@@ -1313,10 +1311,7 @@ ChatTab *ChatWindow::addChatTab(const std::string &name,
chatHandler->joinChannel(name);
return tab;
}
- else
- {
- return addWhisperTab(name, name, switchTo);
- }
+ return addWhisperTab(name, name, switchTo);
}
void ChatWindow::postConnection()
diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp
index e82d9986f..f4f720535 100644
--- a/src/gui/windows/emotewindow.cpp
+++ b/src/gui/windows/emotewindow.cpp
@@ -233,8 +233,7 @@ std::string EmoteWindow::getSelectedFont() const
if (index == 0)
return "##b";
- else
- return "##B";
+ return "##B";
}
void EmoteWindow::clearFont()
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index b6b635c1c..aa240498d 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -542,10 +542,7 @@ int SocialWindow::getPortalIndex(const int x, const int y)
return static_cast<SocialNavigationTab*>(
mNavigation)->getPortalIndex(x, y);
}
- else
- {
- return -1;
- }
+ return -1;
}
void SocialWindow::addPortal(const int x, const int y)
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index b86d86aa3..143a625e7 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -174,12 +174,9 @@ void TradeWindow::setMoney(const int amount)
close();
return;
}
- else
- {
- mMoneyLabel->setForegroundColorAll(
- getThemeColor(ThemeColorId::WARNING),
- getThemeColor(ThemeColorId::WARNING_OUTLINE));
- }
+ mMoneyLabel->setForegroundColorAll(
+ getThemeColor(ThemeColorId::WARNING),
+ getThemeColor(ThemeColorId::WARNING_OUTLINE));
}
else
{
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index 79fe66a4f..1401ec280 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -776,11 +776,8 @@ const std::string WhoIsOnline::prepareNick(const std::string &restrict nick,
return strprintf("@@%s|##%s%s (%d)@@", text.c_str(),
color.c_str(), text.c_str(), level);
}
- else
- {
- return strprintf("@@%s|##%s%s@@", text.c_str(),
- color.c_str(), text.c_str());
- }
+ return strprintf("@@%s|##%s%s@@", text.c_str(),
+ color.c_str(), text.c_str());
}
void WhoIsOnline::optionChanged(const std::string &name)
diff --git a/src/guild.cpp b/src/guild.cpp
index 575220cde..feb986e15 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -369,8 +369,7 @@ std::string Guild::getPos(const int id) const
const PositionsMap::const_iterator it = mPositions.find(id);
if (it == mPositions.end())
return "";
- else
- return it->second;
+ return it->second;
}
void Guild::sort()
diff --git a/src/net/ea/equipbackend.h b/src/net/ea/equipbackend.h
index 49d2b0377..15aeb93fb 100644
--- a/src/net/ea/equipbackend.h
+++ b/src/net/ea/equipbackend.h
@@ -53,8 +53,7 @@ class EquipBackend final : public Equipment::Backend
const Inventory *const inv = PlayerInfo::getInventory();
if (inv != nullptr)
return inv->getItem(invyIndex);
- else
- return nullptr;
+ return nullptr;
}
void clear() override final
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index bc3bcfb83..07482dce7 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -172,11 +172,6 @@ void PartyHandler::setShareItems(const PartyShareT share) const
"share exp");
outMsg.writeInt16(CAST_S16(share), "share items");
}
- else
- {
-// outMsg.writeInt32(CAST_S16(Ea::PartyRecv::mShareExp),
-// "share exp");
- }
}
void PartyHandler::changeLeader(const std::string &name) const
diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp
index 14dd27504..b3fd3da9d 100644
--- a/src/net/ipc.cpp
+++ b/src/net/ipc.cpp
@@ -181,10 +181,8 @@ void IPC::start()
logger->log(" -> Port %d selected", f);
return;
}
- else
- {
- port ++;
- }
+
+ port ++;
}
delete2(ipc);
}
diff --git a/src/net/packetlimiter.cpp b/src/net/packetlimiter.cpp
index 8dc8211b2..ba87badc7 100644
--- a/src/net/packetlimiter.cpp
+++ b/src/net/packetlimiter.cpp
@@ -275,11 +275,8 @@ bool PacketLimiter::checkPackets(const PacketTypeT type)
{
return false;
}
- else
- {
-// instance()->mPacketLimits[type].cnt ++;
- return true;
- }
+// instance()->mPacketLimits[type].cnt ++;
+ return true;
}
// instance()->mPacketLimits[type].lastTime = time;
// instance()->mPacketLimits[type].cnt = 1;
@@ -317,11 +314,8 @@ bool PacketLimiter::limitPackets(const PacketTypeT type)
{
return false;
}
- else
- {
- pack.cnt ++;
- return true;
- }
+ pack.cnt ++;
+ return true;
}
pack.lastTime = time;
pack.cnt = 1;
diff --git a/src/net/tmwa/guildmanager.cpp b/src/net/tmwa/guildmanager.cpp
index 168f4cdea..5484f1b51 100644
--- a/src/net/tmwa/guildmanager.cpp
+++ b/src/net/tmwa/guildmanager.cpp
@@ -428,45 +428,42 @@ bool GuildManager::process(std::string msg)
guild->removeMember(msg);
return true;
}
- else if (msg == "You have been removed from the Guild"
- || msg == "You have left the Guild")
+ else if (msg == "You have been removed from the Guild" ||
+ msg == "You have left the Guild")
{
return afterRemove();
}
- else
+ Guild *const guild = createGuild();
+ if (guild == nullptr)
+ return false;
+ if (mTab == nullptr)
{
- Guild *const guild = createGuild();
- if (guild == nullptr)
- return false;
- if (mTab == nullptr)
- {
- createTab(guild);
- }
- if (mTab != nullptr)
+ createTab(guild);
+ }
+ if (mTab != nullptr)
+ {
+ const size_t pos = msg.find(": ", 0);
+ if (pos != std::string::npos)
{
- const size_t pos = msg.find(": ", 0);
- if (pos != std::string::npos)
- {
- const std::string sender_name = msg.substr(0, pos);
- if (guild->getMember(sender_name) == nullptr)
- {
- mTab->chatLog(msg, ChatMsgType::BY_SERVER);
- return true;
- }
-
- msg.erase(0, pos + 2);
- if (msg.size() > 3 && msg[0] == '#' && msg[1] == '#')
- msg.erase(0, 3);
-
- trim(msg);
- mTab->chatLog(sender_name, msg);
- }
- else
+ const std::string sender_name = msg.substr(0, pos);
+ if (guild->getMember(sender_name) == nullptr)
{
mTab->chatLog(msg, ChatMsgType::BY_SERVER);
+ return true;
}
- return true;
+
+ msg.erase(0, pos + 2);
+ if (msg.size() > 3 && msg[0] == '#' && msg[1] == '#')
+ msg.erase(0, 3);
+
+ trim(msg);
+ mTab->chatLog(sender_name, msg);
+ }
+ else
+ {
+ mTab->chatLog(msg, ChatMsgType::BY_SERVER);
}
+ return true;
}
return false;
}
diff --git a/src/resources/animation/simpleanimation.cpp b/src/resources/animation/simpleanimation.cpp
index ed92d2b50..3ee18830d 100644
--- a/src/resources/animation/simpleanimation.cpp
+++ b/src/resources/animation/simpleanimation.cpp
@@ -141,8 +141,7 @@ Image *SimpleAnimation::getCurrentImage() const
{
if (mCurrentFrame != nullptr)
return mCurrentFrame->image;
- else
- return nullptr;
+ return nullptr;
}
void SimpleAnimation::initializeAnimation(XmlNodeConstPtr animationNode,
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index f077beada..6c082d85f 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -170,10 +170,9 @@ const SoundInfo &BeingInfo::getSound(const ItemSoundEvent::Type event) const
return emptySound;
const SoundInfoVect *const vect = i->second;
- if ((vect == nullptr) || vect->empty())
+ if (vect == nullptr || vect->empty())
return emptySound;
- else
- return vect->at(CAST_SIZE(rand()) % vect->size());
+ return vect->at(CAST_SIZE(rand()) % vect->size());
}
const Attack *BeingInfo::getAttack(const int id) const
diff --git a/src/resources/chatobject.cpp b/src/resources/chatobject.cpp
index 24dc5436d..c0ce7800d 100644
--- a/src/resources/chatobject.cpp
+++ b/src/resources/chatobject.cpp
@@ -57,8 +57,7 @@ ChatObject *ChatObject::findByName(const std::string &name)
chatNameMap.find(name);
if (it == chatNameMap.end())
return nullptr;
- else
- return (*it).second;
+ return (*it).second;
}
ChatObject *ChatObject::findById(const int id)
@@ -66,6 +65,5 @@ ChatObject *ChatObject::findById(const int id)
const std::map<int, ChatObject*>::iterator it = chatIdMap.find(id);
if (it == chatIdMap.end())
return nullptr;
- else
- return (*it).second;
+ return (*it).second;
}
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp
index 4e2fb821d..cfa1a4517 100644
--- a/src/resources/db/avatardb.cpp
+++ b/src/resources/db/avatardb.cpp
@@ -142,6 +142,5 @@ BeingInfo *AvatarDB::get(const BeingTypeId id)
const BeingInfoIterator i = mAvatarInfos.find(id);
if (i == mAvatarInfos.end())
return BeingInfo::unknown;
- else
- return i->second;
+ return i->second;
}
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index 100688d7f..626ef78ae 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -206,10 +206,7 @@ std::string &ColorDB::getHairColorName(const ItemColor id)
toInt(id, int));
return mFail;
}
- else
- {
- return i->second.name;
- }
+ return i->second.name;
}
int ColorDB::getHairSize()
diff --git a/src/resources/db/elementaldb.cpp b/src/resources/db/elementaldb.cpp
index ce11dfeda..1bebf7633 100644
--- a/src/resources/db/elementaldb.cpp
+++ b/src/resources/db/elementaldb.cpp
@@ -148,13 +148,6 @@ BeingInfo *ElementalDb::get(const BeingTypeId id)
toInt(id, int));
return BeingInfo::unknown;
}
- else
- {
- return i->second;
- }
- }
- else
- {
- return i->second;
}
+ return i->second;
}
diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp
index 02018d963..e519b531d 100644
--- a/src/resources/db/emotedb.cpp
+++ b/src/resources/db/emotedb.cpp
@@ -265,10 +265,7 @@ const EmoteInfo *EmoteDB::get(const int id, const bool allowNull)
id);
return &mUnknown;
}
- else
- {
- return i->second;
- }
+ return i->second;
}
const EmoteInfo *EmoteDB::get2(int id, const bool allowNull)
@@ -287,10 +284,7 @@ const EmoteInfo *EmoteDB::get2(int id, const bool allowNull)
id);
return &mUnknown;
}
- else
- {
- return i->second;
- }
+ return i->second;
}
const EmoteSprite *EmoteDB::getSprite(const int id, const bool allowNull)
diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp
index a6453661a..83912e936 100644
--- a/src/resources/db/homunculusdb.cpp
+++ b/src/resources/db/homunculusdb.cpp
@@ -154,13 +154,6 @@ BeingInfo *HomunculusDB::get(const BeingTypeId id)
toInt(id, int));
return BeingInfo::unknown;
}
- else
- {
- return i->second;
- }
- }
- else
- {
- return i->second;
}
+ return i->second;
}
diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp
index a59c18e3f..00228ecd7 100644
--- a/src/resources/db/horsedb.cpp
+++ b/src/resources/db/horsedb.cpp
@@ -293,10 +293,7 @@ HorseInfo *HorseDB::get(const int id, const bool allowNull)
id);
return &mUnknown;
}
- else
- {
- return i->second;
- }
+ return i->second;
}
int HorseDB::size()
diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp
index 464daac63..befbdafea 100644
--- a/src/resources/db/mercenarydb.cpp
+++ b/src/resources/db/mercenarydb.cpp
@@ -152,13 +152,6 @@ BeingInfo *MercenaryDB::get(const BeingTypeId id)
toInt(id, int));
return BeingInfo::unknown;
}
- else
- {
- return i->second;
- }
- }
- else
- {
- return i->second;
}
+ return i->second;
}
diff --git a/src/resources/db/moddb.cpp b/src/resources/db/moddb.cpp
index 7db96f4bd..4e0be461f 100644
--- a/src/resources/db/moddb.cpp
+++ b/src/resources/db/moddb.cpp
@@ -109,8 +109,7 @@ ModInfo *ModDB::get(const std::string &name)
const ModInfoIterator i = mModInfos.find(name);
if (i == mModInfos.end())
return nullptr;
- else
- return i->second;
+ return i->second;
}
const ModInfos &ModDB::getAll()
diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp
index 59b8f9808..b6cdc4f53 100644
--- a/src/resources/db/monsterdb.cpp
+++ b/src/resources/db/monsterdb.cpp
@@ -155,13 +155,6 @@ BeingInfo *MonsterDB::get(const BeingTypeId id)
toInt(id, int));
return BeingInfo::unknown;
}
- else
- {
- return i->second;
- }
- }
- else
- {
- return i->second;
}
+ return i->second;
}
diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp
index d6cc55264..26034de12 100644
--- a/src/resources/db/npcdb.cpp
+++ b/src/resources/db/npcdb.cpp
@@ -191,10 +191,7 @@ BeingInfo *NPCDB::get(const BeingTypeId id)
toInt(id, int));
return BeingInfo::unknown;
}
- else
- {
- return i->second;
- }
+ return i->second;
}
BeingTypeId NPCDB::getAvatarFor(const BeingTypeId id)
diff --git a/src/resources/db/palettedb.cpp b/src/resources/db/palettedb.cpp
index 484e62751..d7ec6b78d 100644
--- a/src/resources/db/palettedb.cpp
+++ b/src/resources/db/palettedb.cpp
@@ -111,6 +111,5 @@ const DyeColor *PaletteDB::getColor(const std::string &name)
mColors.find(name);
if (it != mColors.end())
return &(*it).second;
- else
- return nullptr;
+ return nullptr;
}
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index 2710356ae..721b27bfb 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -163,8 +163,5 @@ BeingInfo *PETDB::get(const BeingTypeId id)
toInt(id, int));
return BeingInfo::unknown;
}
- else
- {
- return i->second;
- }
+ return i->second;
}
diff --git a/src/resources/db/skillunitdb.cpp b/src/resources/db/skillunitdb.cpp
index d7028e672..0150c4a16 100644
--- a/src/resources/db/skillunitdb.cpp
+++ b/src/resources/db/skillunitdb.cpp
@@ -157,8 +157,5 @@ BeingInfo *SkillUnitDb::get(const BeingTypeId id)
toInt(id, int));
return BeingInfo::unknown;
}
- else
- {
- return i->second;
- }
+ return i->second;
}
diff --git a/src/resources/db/unitsdb.cpp b/src/resources/db/unitsdb.cpp
index ab42ba04c..aac6b72e3 100644
--- a/src/resources/db/unitsdb.cpp
+++ b/src/resources/db/unitsdb.cpp
@@ -254,74 +254,70 @@ static std::string formatUnit(const int value,
ul = ud.levels[0];
return strprintf("0%s", ul.symbol.c_str());
}
- else
+
+ double amount = ud.conversion * value;
+ const unsigned int sz = CAST_U32(ud.levels.size());
+
+ // If only the first level is needed, act like mix if false
+ if (ud.mix && !ud.levels.empty() && ud.levels[1].count < amount)
{
- double amount = ud.conversion * value;
- const unsigned int sz = CAST_U32(ud.levels.size());
+ std::string output;
+ UnitLevel pl = ud.levels[0];
+ ul = ud.levels[1];
+ int levelAmount = CAST_S32(amount);
+ int nextAmount = 0;
- // If only the first level is needed, act like mix if false
- if (ud.mix && !ud.levels.empty() && ud.levels[1].count < amount)
- {
- std::string output;
- UnitLevel pl = ud.levels[0];
- ul = ud.levels[1];
- int levelAmount = CAST_S32(amount);
- int nextAmount = 0;
+ if (ul.count != 0)
+ levelAmount /= ul.count;
- if (ul.count != 0)
- levelAmount /= ul.count;
+ amount -= static_cast<double>(levelAmount * ul.count);
- amount -= static_cast<double>(levelAmount * ul.count);
+ if (amount > 0)
+ {
+ output = splitNumber(strprintf("%.*f", pl.round,
+ amount), pl.separator).append(pl.symbol);
+ }
+
+ for (unsigned int i = 2; i < sz; i++)
+ {
+ pl = ul;
+ ul = ud.levels[i];
- if (amount > 0)
+ if (ul.count != 0)
{
- output = splitNumber(strprintf("%.*f", pl.round,
- amount), pl.separator).append(pl.symbol);
+ nextAmount = levelAmount / ul.count;
+ levelAmount %= ul.count;
}
- for (unsigned int i = 2; i < sz; i++)
+ if (levelAmount > 0)
{
- pl = ul;
- ul = ud.levels[i];
-
- if (ul.count != 0)
- {
- nextAmount = levelAmount / ul.count;
- levelAmount %= ul.count;
- }
-
- if (levelAmount > 0)
- {
- output = splitNumber(strprintf("%d", levelAmount),
- pl.separator).append(pl.symbol).append(output);
- }
-
- if (nextAmount == 0)
- break;
- levelAmount = nextAmount;
+ output = splitNumber(strprintf("%d", levelAmount),
+ pl.separator).append(pl.symbol).append(output);
}
- return output;
+ if (nextAmount == 0)
+ break;
+ levelAmount = nextAmount;
}
- else
- {
- ul.round = 0;
- for (unsigned int i = 0; i < sz; i++)
- {
- ul = ud.levels[i];
- if (amount < ul.count && ul.count > 0)
- {
- ul = ud.levels[i - 1];
- break;
- }
- if (ul.count != 0)
- amount /= ul.count;
- }
- return splitNumber(strprintf("%.*f", ul.round, amount),
- ul.separator).append(ul.symbol);
+ return output;
+ }
+
+ ul.round = 0;
+ for (unsigned int i = 0; i < sz; i++)
+ {
+ ul = ud.levels[i];
+ if (amount < ul.count && ul.count > 0)
+ {
+ ul = ud.levels[i - 1];
+ break;
}
+ if (ul.count != 0)
+ amount /= ul.count;
}
+
+ return splitNumber(strprintf("%.*f", ul.round, amount),
+ ul.separator).append(ul.symbol);
}
std::string UnitsDb::formatCurrency(const int value)
diff --git a/src/resources/image/image.cpp b/src/resources/image/image.cpp
index 03f35a77c..ec17bbdf4 100644
--- a/src/resources/image/image.cpp
+++ b/src/resources/image/image.cpp
@@ -330,12 +330,9 @@ void Image::setAlpha(const float alpha)
mAlpha = alpha;
return;
}
- else
- {
- mSDLSurface = SDLImageHelper::SDLDuplicateSurface(mSDLSurface);
- if (mSDLSurface == nullptr)
- return;
- }
+ mSDLSurface = SDLImageHelper::SDLDuplicateSurface(mSDLSurface);
+ if (mSDLSurface == nullptr)
+ return;
}
mAlpha = alpha;
diff --git a/src/resources/image/subimage.cpp b/src/resources/image/subimage.cpp
index 735ed27f5..9eda05164 100644
--- a/src/resources/image/subimage.cpp
+++ b/src/resources/image/subimage.cpp
@@ -215,8 +215,7 @@ Image *SubImage::getSubImage(const int x, const int y,
{
if (mParent != nullptr)
return mParent->getSubImage(mBounds.x + x, mBounds.y + y, w, h);
- else
- return nullptr;
+ return nullptr;
}
#ifdef USE_OPENGL
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index 9f6bb2ecc..724038100 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -71,10 +71,7 @@ Image* ImageSet::get(const size_type i) const
CAST_S32(i));
return nullptr;
}
- else
- {
- return mImages[i];
- }
+ return mImages[i];
}
int ImageSet::calcMemoryLocal() const
diff --git a/src/resources/item/item.cpp b/src/resources/item/item.cpp
index 897340732..a9a2c89df 100644
--- a/src/resources/item/item.cpp
+++ b/src/resources/item/item.cpp
@@ -144,11 +144,8 @@ std::string Item::getName() const
{
return info.getName();
}
- else
#endif // TWMA_SUPPORT
- {
- return info.getName(mColor);
- }
+ return info.getName(mColor);
}
void Item::setCard(const int index, const int id)
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 2997a48ad..60810e000 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -104,20 +104,17 @@ const std::string &ItemInfo::getSprite(const GenderT gender,
// Forward the request to the item defining how to view this item
return ItemDB::get(mView).getSprite(gender, race);
}
- else
- {
- static const std::string empty;
- std::map<int, std::string>::const_iterator i =
- mAnimationFiles.find(CAST_S32(gender) +
- toInt(race, int) * 4);
-
- if (i != mAnimationFiles.end())
- return i->second;
- i = mAnimationFiles.find(CAST_S32(gender));
- if (i != mAnimationFiles.end())
- return i->second;
- return empty;
- }
+ static const std::string empty;
+ std::map<int, std::string>::const_iterator i =
+ mAnimationFiles.find(CAST_S32(gender) +
+ toInt(race, int) * 4);
+
+ if (i != mAnimationFiles.end())
+ return i->second;
+ i = mAnimationFiles.find(CAST_S32(gender));
+ if (i != mAnimationFiles.end())
+ return i->second;
+ return empty;
}
void ItemInfo::setAttackAction(const std::string &attackAction)
diff --git a/src/resources/loaders/musicloader.cpp b/src/resources/loaders/musicloader.cpp
index f0b67cb67..e734ddce6 100644
--- a/src/resources/loaders/musicloader.cpp
+++ b/src/resources/loaders/musicloader.cpp
@@ -66,11 +66,9 @@ namespace
return new SDLMusic(music, rw, rl->path);
}
#endif // USE_SDL2
- else
- {
- logger->log("Error, failed to load music: %s", Mix_GetError());
- return nullptr;
- }
+
+ logger->log("Error, failed to load music: %s", Mix_GetError());
+ return nullptr;
}
};
} // namespace
diff --git a/src/resources/loaders/soundloader.cpp b/src/resources/loaders/soundloader.cpp
index a84898201..b99b48b6c 100644
--- a/src/resources/loaders/soundloader.cpp
+++ b/src/resources/loaders/soundloader.cpp
@@ -60,12 +60,9 @@ namespace
{
return new SoundEffect(tmpSoundEffect, rl->path);
}
- else
- {
- reportAlways("Error, failed to load sound effect: %s",
- Mix_GetError());
- return nullptr;
- }
+ reportAlways("Error, failed to load sound effect: %s",
+ Mix_GetError());
+ return nullptr;
}
};
} // namespace
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 675c9ca58..6a70048e8 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -689,8 +689,7 @@ const Tileset *Map::getTilesetWithGid(const int gid) const restrict2
{
if (gid >= 0 && gid < mIndexedTilesetsSize)
return mIndexedTilesets[gid];
- else
- return nullptr;
+ return nullptr;
}
void Map::addBlockMask(const int x, const int y,
diff --git a/src/resources/sdlmusic.cpp b/src/resources/sdlmusic.cpp
index d3801d453..be363fc48 100644
--- a/src/resources/sdlmusic.cpp
+++ b/src/resources/sdlmusic.cpp
@@ -62,8 +62,7 @@ bool SDLMusic::play(const int loops,
{
if (fadeIn > 0)
return Mix_FadeInMusicPos(mMusic, loops, fadeIn, 0.0) != 0;
- else
- return Mix_FadeInMusicPos(mMusic, loops, 0, 0.0) != 0;
+ return Mix_FadeInMusicPos(mMusic, loops, 0, 0.0) != 0;
}
int SDLMusic::calcMemoryLocal() const
diff --git a/src/resources/sprite/animatedsprite.cpp b/src/resources/sprite/animatedsprite.cpp
index d2dbc1b72..4905f2f3e 100644
--- a/src/resources/sprite/animatedsprite.cpp
+++ b/src/resources/sprite/animatedsprite.cpp
@@ -383,24 +383,21 @@ unsigned int AnimatedSprite::getFrameCount() const restrict2
{
if (mAnimation != nullptr)
return CAST_U32(mAnimation->getLength());
- else
- return 0;
+ return 0;
}
int AnimatedSprite::getWidth() const restrict2
{
if ((mFrame != nullptr) && (mFrame->image != nullptr))
return mFrame->image->mBounds.w;
- else
- return 0;
+ return 0;
}
int AnimatedSprite::getHeight() const restrict2
{
if ((mFrame != nullptr) && (mFrame->image != nullptr))
return mFrame->image->mBounds.h;
- else
- return 0;
+ return 0;
}
std::string AnimatedSprite::getIdPath() const restrict2
diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp
index ccb8af30c..5fdb68584 100644
--- a/src/resources/sprite/spritedef.cpp
+++ b/src/resources/sprite/spritedef.cpp
@@ -112,8 +112,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile,
doc->decRef();
if (animationFile != errorFile)
return load(errorFile, 0, prot);
- else
- return nullptr;
+ return nullptr;
}
SpriteDef *const def = new SpriteDef;
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 1fc253f72..dfaca1f30 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -69,8 +69,7 @@ static void initDefaultWallpaperPaths()
if (!wallpaperFile.empty() && !VirtFs::isDirectory(wallpaperFile))
return;
- else
- wallpaperFile = paths.getValue("wallpaperFile", "");
+ wallpaperFile = paths.getValue("wallpaperFile", "");
if (wallpaperFile.empty() || VirtFs::isDirectory(wallpaperFile))
wallpaperFile = "login_wallpaper.png";
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index e46852a23..7cd71a5d7 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -70,18 +70,16 @@ void StatusEffect::deliverMessage() const
Particle *StatusEffect::getStartParticle() const
{
- if ((particleEngine == nullptr) || mStartParticleEffect.empty())
+ if (particleEngine == nullptr || mStartParticleEffect.empty())
return nullptr;
- else
- return particleEngine->addEffect(mStartParticleEffect, 0, 0);
+ return particleEngine->addEffect(mStartParticleEffect, 0, 0);
}
Particle *StatusEffect::getParticle() const
{
- if ((particleEngine == nullptr) || mParticleEffect.empty())
+ if (particleEngine == nullptr || mParticleEffect.empty())
return nullptr;
- else
- return particleEngine->addEffect(mParticleEffect, 0, 0);
+ return particleEngine->addEffect(mParticleEffect, 0, 0);
}
AnimatedSprite *StatusEffect::getIcon() const
@@ -90,17 +88,13 @@ AnimatedSprite *StatusEffect::getIcon() const
{
return nullptr;
}
- else
- {
- return AnimatedSprite::load(pathJoin(paths.getStringValue("sprites"),
- mIcon));
- }
+ return AnimatedSprite::load(pathJoin(paths.getStringValue("sprites"),
+ mIcon));
}
std::string StatusEffect::getAction() const
{
if (mAction.empty())
return SpriteAction::INVALID;
- else
- return mAction;
+ return mAction;
}
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 8920d111b..ecbd7de19 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -560,10 +560,7 @@ std::string combineDye2(std::string file,
}
return file.append("|").append(str);
}
- else
- {
- return file;
- }
+ return file;
}
std::string combineDye3(std::string file,
@@ -588,13 +585,9 @@ std::string combineDye3(std::string file,
}
return file.append("|").append(str);
}
- else
- {
- if (dye.empty() || file.empty())
- return file;
- else
- return file.append("|").append(dye);
- }
+ if (dye.empty() || file.empty())
+ return file;
+ return file.append("|").append(dye);
}
std::string packList(const std::list<std::string> &list)
@@ -959,8 +952,7 @@ std::string timeToStr(const uint32_t time)
tm *const timeInfo = localtime(&tempTime);
if (strftime(&buf[0], 100, "%Y-%m-%d_%H-%M-%S", timeInfo) != 0u)
return std::string(buf);
- else
- return "unknown";
+ return "unknown";
}
std::string timeDiffToString(int timeDiff)
@@ -1060,30 +1052,26 @@ std::string pathJoin(std::string str1,
{
if (str2[0] == sep)
return str2;
- else
- return sepStr.append(str2);
+ return sepStr.append(str2);
}
const size_t sz1 = str1.size();
if (str2.empty())
{
if (str1[sz1 - 1] == sep)
return str1;
- else
- return str1.append(sepStr);
+ return str1.append(sepStr);
}
if (str1[sz1 - 1] == sep)
{
if (str2[0] == sep)
return str1.append(str2.substr(1));
- else
- return str1.append(str2);
+ return str1.append(str2);
}
else
{
if (str2[0] == sep)
return str1.append(str2);
- else
- return str1.append(sepStr).append(str2);
+ return str1.append(sepStr).append(str2);
}
}
@@ -1132,15 +1120,13 @@ std::string pathJoin(std::string str1,
{
if (str3[0] == sep)
return str1.append(str3.substr(1));
- else
- return str1.append(str3);
+ return str1.append(str3);
}
else
{
if (str3[0] == sep)
return str1.append(str3);
- else
- return str1.append(sepStr).append(str3);
+ return str1.append(sepStr).append(str3);
}
}
@@ -1154,30 +1140,26 @@ std::string urlJoin(std::string str1,
{
if (str2[0] == sep)
return str2;
- else
- return sepStr.append(str2);
+ return sepStr.append(str2);
}
const size_t sz1 = str1.size();
if (str2.empty())
{
if (str1[sz1 - 1] == sep)
return str1;
- else
- return str1.append(sepStr);
+ return str1.append(sepStr);
}
if (str1[sz1 - 1] == sep)
{
if (str2[0] == sep)
return str1.append(str2.substr(1));
- else
- return str1.append(str2);
+ return str1.append(str2);
}
else
{
if (str2[0] == sep)
return str1.append(str2);
- else
- return str1.append(sepStr).append(str2);
+ return str1.append(sepStr).append(str2);
}
}
diff --git a/src/utils/timer.cpp b/src/utils/timer.cpp
index cb224e8e5..21ef307ba 100644
--- a/src/utils/timer.cpp
+++ b/src/utils/timer.cpp
@@ -97,11 +97,8 @@ int get_elapsed_time(const int startTime)
{
return (time - startTime) * MILLISECONDS_IN_A_TICK;
}
- else
- {
- return (time + (MAX_TICK_VALUE - startTime))
- * MILLISECONDS_IN_A_TICK;
- }
+ return (time + (MAX_TICK_VALUE - startTime))
+ * MILLISECONDS_IN_A_TICK;
}
int get_elapsed_time1(const int startTime)
@@ -109,8 +106,7 @@ int get_elapsed_time1(const int startTime)
const int time = tick_time;
if (startTime <= time)
return time - startTime;
- else
- return time + (MAX_TICK_VALUE - startTime);
+ return time + (MAX_TICK_VALUE - startTime);
}
void startTimers()
diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp
index 1050cc82e..399980a21 100644
--- a/src/utils/translation/poparser.cpp
+++ b/src/utils/translation/poparser.cpp
@@ -160,35 +160,33 @@ bool PoParser::readMsgId()
mReadingId = false;
return false;
}
- else
+
+ // check line start from msgid "
+ if (strStartWith(mLine, msgId1))
{
- // check line start from msgid "
- if (strStartWith(mLine, msgId1))
- {
- if (!mSkipId)
- { // translation not fuzzed and can be processed
- mReadingId = true;
- const size_t msgId1Size = msgId1.size();
- // reading text from: msgid "text"
- mMsgId.append(mLine.substr(msgId1Size,
- mLine.size() - 1 - msgId1Size));
- }
- else
- { // skipped fuzzed translation. reset skip flag
- mSkipId = false;
- }
- mLine.clear();
- return true;
+ if (!mSkipId)
+ { // translation not fuzzed and can be processed
+ mReadingId = true;
+ const size_t msgId1Size = msgId1.size();
+ // reading text from: msgid "text"
+ mMsgId.append(mLine.substr(msgId1Size,
+ mLine.size() - 1 - msgId1Size));
}
- else if (mLine == "#, fuzzy")
- { // check for fuzzy translation
- mSkipId = true;
- mLine.clear();
- return true;
+ else
+ { // skipped fuzzed translation. reset skip flag
+ mSkipId = false;
}
- // stop reading if we don't read msgid before
- return mMsgId.empty();
+ mLine.clear();
+ return true;
+ }
+ else if (mLine == "#, fuzzy")
+ { // check for fuzzy translation
+ mSkipId = true;
+ mLine.clear();
+ return true;
}
+ // stop reading if we don't read msgid before
+ return mMsgId.empty();
}
bool PoParser::readMsgStr()