summaryrefslogtreecommitdiff
path: root/src/resources/db
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/resources/db
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadmanaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
manaplus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/resources/db')
-rw-r--r--src/resources/db/avatardb.cpp4
-rw-r--r--src/resources/db/chardb.cpp6
-rw-r--r--src/resources/db/colordb.cpp4
-rw-r--r--src/resources/db/commandsdb.cpp4
-rw-r--r--src/resources/db/deaddb.cpp8
-rw-r--r--src/resources/db/elementaldb.cpp6
-rw-r--r--src/resources/db/emotedb.cpp12
-rw-r--r--src/resources/db/homunculusdb.cpp6
-rw-r--r--src/resources/db/horsedb.cpp4
-rw-r--r--src/resources/db/itemdb.cpp70
-rw-r--r--src/resources/db/itemfielddb.cpp2
-rw-r--r--src/resources/db/itemoptiondb.cpp2
-rw-r--r--src/resources/db/languagedb.cpp2
-rw-r--r--src/resources/db/mapdb.cpp8
-rw-r--r--src/resources/db/mercenarydb.cpp6
-rw-r--r--src/resources/db/moddb.cpp4
-rw-r--r--src/resources/db/monsterdb.cpp6
-rw-r--r--src/resources/db/npcdb.cpp6
-rw-r--r--src/resources/db/npcdialogdb.cpp2
-rw-r--r--src/resources/db/petdb.cpp4
-rw-r--r--src/resources/db/questdb.cpp6
-rw-r--r--src/resources/db/skillunitdb.cpp4
-rw-r--r--src/resources/db/sounddb.cpp4
-rw-r--r--src/resources/db/statdb.cpp2
-rw-r--r--src/resources/db/statuseffectdb.cpp6
-rw-r--r--src/resources/db/textdb.cpp2
-rw-r--r--src/resources/db/unitsdb.cpp10
27 files changed, 100 insertions, 100 deletions
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp
index eddf08b29..86c2ff5aa 100644
--- a/src/resources/db/avatardb.cpp
+++ b/src/resources/db/avatardb.cpp
@@ -59,7 +59,7 @@ void AvatarDB::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "avatars"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "avatars"))
{
logger->log("Avatars Database: Error while loading %s!",
fileName.c_str());
@@ -85,7 +85,7 @@ void AvatarDB::loadXmlFile(const std::string &fileName,
BeingInfo *currentInfo = nullptr;
if (mAvatarInfos.find(id) != mAvatarInfos.end())
currentInfo = mAvatarInfos[id];
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new BeingInfo;
currentInfo->setName(XML::langProperty(
diff --git a/src/resources/db/chardb.cpp b/src/resources/db/chardb.cpp
index b0984a56f..fe87ea157 100644
--- a/src/resources/db/chardb.cpp
+++ b/src/resources/db/chardb.cpp
@@ -54,7 +54,7 @@ void CharDB::load()
SkipError_false);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root || !xmlNameEqual(root, "chars"))
+ if ((root == nullptr) || !xmlNameEqual(root, "chars"))
{
logger->log("CharDB: Failed to parse %s.",
paths.getStringValue("charCreationFile").c_str());
@@ -113,9 +113,9 @@ void CharDB::loadMinMax(XmlNodeConstPtr node,
unsigned *restrict const min,
unsigned *restrict const max)
{
- if (min)
+ if (min != nullptr)
*min = XML::getProperty(node, "min", 1);
- if (max)
+ if (max != nullptr)
*max = XML::getProperty(node, "max", 10);
}
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index cf377eca1..15e66bb5b 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -83,7 +83,7 @@ void ColorDB::loadHair(const std::string &fileName,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root || !xmlNameEqual(root, "colors"))
+ if ((root == nullptr) || !xmlNameEqual(root, "colors"))
{
logger->log("ColorDB: Failed to find hair colors file.");
if (colors.find(ItemColor_zero) == colors.end())
@@ -128,7 +128,7 @@ void ColorDB::loadColorLists(const std::string &fileName,
UseVirtFs_true,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root)
+ if (root == nullptr)
{
delete doc;
return;
diff --git a/src/resources/db/commandsdb.cpp b/src/resources/db/commandsdb.cpp
index 115046b1d..eec3eb7ce 100644
--- a/src/resources/db/commandsdb.cpp
+++ b/src/resources/db/commandsdb.cpp
@@ -64,7 +64,7 @@ void CommandsDB::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "commands"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "commands"))
{
logger->log("Commands Database: Error while loading %s!",
fileName.c_str());
@@ -121,7 +121,7 @@ void CommandsDB::loadXmlFile(const std::string &fileName,
TextCommand *cmd = nullptr;
#ifdef TMWA_SUPPORT
- if (skill1)
+ if (skill1 != 0)
{
cmd = new TextCommand(id,
name,
diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp
index 53a0f6e0f..bcca023eb 100644
--- a/src/resources/db/deaddb.cpp
+++ b/src/resources/db/deaddb.cpp
@@ -54,7 +54,7 @@ void DeadDB::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root || !xmlNameEqual(root, "messages"))
+ if ((root == nullptr) || !xmlNameEqual(root, "messages"))
{
logger->log("DeadDB: Failed to parse %s.",
paths.getStringValue("deadMessagesFile").c_str());
@@ -75,9 +75,9 @@ void DeadDB::loadXmlFile(const std::string &fileName,
{
XmlChar *const data = reinterpret_cast<XmlChar*>(
XmlNodeGetContent(node));
- if (!data)
+ if (data == nullptr)
continue;
- if (!*data)
+ if (*data == 0)
{
XmlFree(data);
continue;
@@ -99,7 +99,7 @@ void DeadDB::unload()
std::string DeadDB::getRandomString()
{
const size_t sz = mMessages.size();
- if (!sz)
+ if (sz == 0u)
return std::string();
return translator->getStr(mMessages[rand() % sz]);
}
diff --git a/src/resources/db/elementaldb.cpp b/src/resources/db/elementaldb.cpp
index 2a626a10e..8701081a3 100644
--- a/src/resources/db/elementaldb.cpp
+++ b/src/resources/db/elementaldb.cpp
@@ -57,7 +57,7 @@ void ElementalDb::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtr rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "elementals"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "elementals"))
{
logger->log("Elemental Database: Error while loading %s!",
paths.getStringValue("elementalsFile").c_str());
@@ -89,7 +89,7 @@ void ElementalDb::loadXmlFile(const std::string &fileName,
logger->log("ElementalDb: Redefinition of elemental ID %d", id);
currentInfo = mElementalInfos[fromInt(id + offset, BeingTypeId)];
}
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new BeingInfo;
currentInfo->setBlockType(BlockType::NONE);
@@ -107,7 +107,7 @@ void ElementalDb::loadXmlFile(const std::string &fileName,
currentInfo->setColorsList(XML::getProperty(elementalNode,
"colors", ""));
- if (currentInfo->getMaxHP())
+ if (currentInfo->getMaxHP() != 0)
currentInfo->setStaticMaxHP(true);
SpriteDisplay display;
diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp
index 7d9e47e8b..085f81abe 100644
--- a/src/resources/db/emotedb.cpp
+++ b/src/resources/db/emotedb.cpp
@@ -75,7 +75,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodePtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "emotes"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "emotes"))
{
logger->log("Emote Database: Error while loading %s!",
fileName.c_str());
@@ -113,7 +113,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName,
currentInfo = mEmoteInfos[id];
else
currentInfo = new EmoteInfo;
- if (!currentInfo)
+ if (currentInfo == nullptr)
continue;
currentInfo->time = XML::getProperty(emoteNode, "time", 500);
currentInfo->effectId = XML::getProperty(emoteNode, "effect", -1);
@@ -152,7 +152,7 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodePtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "emotes"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "emotes"))
{
logger->log1("Emote Database: Error while loading"
" manaplus_emotes.xml!");
@@ -186,7 +186,7 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName,
EmoteInfo *currentInfo = nullptr;
if (mEmoteInfos.find(id) != mEmoteInfos.end())
currentInfo = mEmoteInfos[id];
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new EmoteInfo;
currentInfo->time = XML::getProperty(emoteNode, "time", 500);
currentInfo->effectId = XML::getProperty(emoteNode, "effect", -1);
@@ -226,7 +226,7 @@ void EmoteDB::unload()
{
FOR_EACH (EmoteInfos::const_iterator, i, mEmoteInfos)
{
- if (i->second)
+ if (i->second != nullptr)
{
std::list<EmoteSprite*> &sprites = i->second->sprites;
while (!sprites.empty())
@@ -295,7 +295,7 @@ const EmoteInfo *EmoteDB::get2(int id, const bool allowNull)
const EmoteSprite *EmoteDB::getSprite(const int id, const bool allowNull)
{
const EmoteInfo *const info = get(id, allowNull);
- if (!info)
+ if (info == nullptr)
return nullptr;
return info->sprites.front();
diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp
index cf627dc01..3fdced887 100644
--- a/src/resources/db/homunculusdb.cpp
+++ b/src/resources/db/homunculusdb.cpp
@@ -58,7 +58,7 @@ void HomunculusDB::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtr rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "homunculuses"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "homunculuses"))
{
logger->log("Homunculus Database: Error while loading %s!",
paths.getStringValue("homunculusesFile").c_str());
@@ -90,7 +90,7 @@ void HomunculusDB::loadXmlFile(const std::string &fileName,
logger->log("HomunculusDB: Redefinition of homunculus ID %d", id);
currentInfo = mHomunculusInfos[fromInt(id + offset, BeingTypeId)];
}
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new BeingInfo;
currentInfo->setBlockType(BlockType::NONE);
@@ -114,7 +114,7 @@ void HomunculusDB::loadXmlFile(const std::string &fileName,
currentInfo->setColorsList(XML::getProperty(homunculusNode,
"colors", ""));
- if (currentInfo->getMaxHP())
+ if (currentInfo->getMaxHP() != 0)
currentInfo->setStaticMaxHP(true);
SpriteDisplay display;
diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp
index a6b395d3f..961fbca32 100644
--- a/src/resources/db/horsedb.cpp
+++ b/src/resources/db/horsedb.cpp
@@ -153,7 +153,7 @@ void HorseDB::loadXmlFile(const std::string &fileName,
skipError);
XmlNodePtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "horses"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "horses"))
{
logger->log("Horse Database: Error while loading %s!",
fileName.c_str());
@@ -189,7 +189,7 @@ void HorseDB::loadXmlFile(const std::string &fileName,
else
currentInfo = new HorseInfo;
- if (!currentInfo)
+ if (currentInfo == nullptr)
continue;
for_each_xml_child_node(spriteNode, horseNode)
{
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 4bd68c42e..6efe6086f 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -129,7 +129,7 @@ static void readFields(std::string &effect,
XmlNodeConstPtr node,
const ItemFieldDb::FieldInfos &fields)
{
- if (!translator)
+ if (translator == nullptr)
return;
FOR_EACH (ItemFieldDb::FieldInfos::const_iterator, it, fields)
@@ -249,7 +249,7 @@ void ItemDB::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "items"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "items"))
{
logger->log("ItemDB: Error while loading %s!", fileName.c_str());
mLoaded = true;
@@ -287,7 +287,7 @@ void ItemDB::loadXmlFile(const std::string &fileName,
logger->log("ItemDB: Redefinition of item ID %d", id);
itemInfo = mItemInfos[id];
}
- if (!itemInfo)
+ if (itemInfo == nullptr)
itemInfo = new ItemInfo;
const std::string typeStr = XML::getProperty(node, "type", "");
@@ -375,7 +375,7 @@ void ItemDB::loadXmlFile(const std::string &fileName,
}
itemInfo->setId(id);
- if (name.empty() && inheritItemInfo)
+ if (name.empty() && (inheritItemInfo != nullptr))
name = inheritItemInfo->getName();
// TRANSLATORS: item info name
itemInfo->setName(name.empty() ? _("unnamed") : name);
@@ -389,12 +389,12 @@ void ItemDB::loadXmlFile(const std::string &fileName,
itemInfo->setNameEn(nameEn);
}
- if (description.empty() && inheritItemInfo)
+ if (description.empty() && (inheritItemInfo != nullptr))
description = inheritItemInfo->getDescription();
itemInfo->setDescription(description);
if (typeStr.empty())
{
- if (inheritItemInfo)
+ if (inheritItemInfo != nullptr)
itemInfo->setType(inheritItemInfo->getType());
else
itemInfo->setType(itemTypeFromString("other"));
@@ -404,12 +404,12 @@ void ItemDB::loadXmlFile(const std::string &fileName,
itemInfo->setType(itemTypeFromString(typeStr));
}
itemInfo->setType(itemTypeFromString(typeStr));
- if (useButton.empty() && inheritItemInfo)
+ if (useButton.empty() && (inheritItemInfo != nullptr))
useButton = inheritItemInfo->getUseButton();
if (useButton.empty())
useButton = useButtonFromItemType(itemInfo->getType());
itemInfo->setUseButton(useButton);
- if (useButton2.empty() && inheritItemInfo)
+ if (useButton2.empty() && (inheritItemInfo != nullptr))
useButton2 = inheritItemInfo->getUseButton();
if (useButton2.empty())
useButton2 = useButton2FromItemType(itemInfo->getType());
@@ -419,7 +419,7 @@ void ItemDB::loadXmlFile(const std::string &fileName,
node, "sellProtected", false));
if (cardColor != -1)
itemInfo->setCardColor(fromInt(cardColor, ItemColor));
- else if (inheritItemInfo)
+ else if (inheritItemInfo != nullptr)
itemInfo->setCardColor(inheritItemInfo->getCardColor());
switch (itemInfo->getType())
@@ -462,46 +462,46 @@ void ItemDB::loadXmlFile(const std::string &fileName,
}
}
- if (!view && inheritItemInfo)
+ if ((view == 0) && (inheritItemInfo != nullptr))
view = inheritItemInfo->getView();
itemInfo->setView(view);
- if (!weight && inheritItemInfo)
+ if ((weight == 0) && (inheritItemInfo != nullptr))
weight = inheritItemInfo->getWeight();
itemInfo->setWeight(weight);
- if (attackAction.empty() && inheritItemInfo)
+ if (attackAction.empty() && (inheritItemInfo != nullptr))
attackAction = inheritItemInfo->getAttackAction();
itemInfo->setAttackAction(attackAction);
- if (skyAttackAction.empty() && inheritItemInfo)
+ if (skyAttackAction.empty() && (inheritItemInfo != nullptr))
skyAttackAction = inheritItemInfo->getSkyAttackAction();
itemInfo->setSkyAttackAction(skyAttackAction);
- if (waterAttackAction.empty() && inheritItemInfo)
+ if (waterAttackAction.empty() && (inheritItemInfo != nullptr))
waterAttackAction = inheritItemInfo->getWaterAttackAction();
itemInfo->setWaterAttackAction(waterAttackAction);
- if (rideAttackAction.empty() && inheritItemInfo)
+ if (rideAttackAction.empty() && (inheritItemInfo != nullptr))
rideAttackAction = inheritItemInfo->getRideAttackAction();
itemInfo->setRideAttackAction(rideAttackAction);
- if (!attackRange && inheritItemInfo)
+ if ((attackRange == 0) && (inheritItemInfo != nullptr))
attackRange = inheritItemInfo->getAttackRange();
itemInfo->setAttackRange(attackRange);
- if (missileParticle.empty() && inheritItemInfo)
+ if (missileParticle.empty() && (inheritItemInfo != nullptr))
missileParticle = inheritItemInfo->getMissileParticleFile();
itemInfo->setMissileParticleFile(missileParticle);
- if (!hitEffectId && inheritItemInfo)
+ if ((hitEffectId == 0) && (inheritItemInfo != nullptr))
hitEffectId = inheritItemInfo->getHitEffectId();
itemInfo->setHitEffectId(hitEffectId);
- if (!criticalEffectId && inheritItemInfo)
+ if ((criticalEffectId == 0) && (inheritItemInfo != nullptr))
criticalEffectId = inheritItemInfo->getCriticalHitEffectId();
itemInfo->setCriticalHitEffectId(criticalEffectId);
- if (!missEffectId && inheritItemInfo)
+ if ((missEffectId == 0) && (inheritItemInfo != nullptr))
missEffectId = inheritItemInfo->getMissEffectId();
itemInfo->setMissEffectId(missEffectId);
itemInfo->setDrawBefore(-1, parseSpriteName(drawBefore));
itemInfo->setDrawAfter(-1, parseSpriteName(drawAfter));
itemInfo->setDrawPriority(-1, drawPriority);
- if (colors.empty() && inheritItemInfo)
+ if (colors.empty() && (inheritItemInfo != nullptr))
colors = inheritItemInfo->getColorsListName();
itemInfo->setColorsList(colors);
- if (iconColors.empty() && inheritItemInfo)
+ if (iconColors.empty() && (inheritItemInfo != nullptr))
iconColors = inheritItemInfo->getIconColorsListName();
itemInfo->setIconColorsList(iconColors);
itemInfo->setMaxFloorOffsetX(maxFloorOffsetX);
@@ -516,7 +516,7 @@ void ItemDB::loadXmlFile(const std::string &fileName,
if (!effect.empty() && !temp.empty())
effect.append(" / ");
effect.append(temp);
- if (effect.empty() && inheritItemInfo)
+ if (effect.empty() && (inheritItemInfo != nullptr))
effect = inheritItemInfo->getEffect();
itemInfo->setEffect(effect);
@@ -840,7 +840,7 @@ static int parseDirectionName(const std::string &name)
static void loadSpriteRef(ItemInfo *const itemInfo, XmlNodeConstPtr node)
{
const std::string gender = XML::getProperty(node, "gender", "unisex");
- if (!node || !XmlHaveChildContent(node))
+ if ((node == nullptr) || !XmlHaveChildContent(node))
return;
const std::string filename = XmlChildContent(node);
@@ -856,7 +856,7 @@ static void loadSpriteRef(ItemInfo *const itemInfo, XmlNodeConstPtr node)
static void loadSoundRef(ItemInfo *const itemInfo, XmlNodeConstPtr node)
{
- if (!node || !XmlHaveChildContent(node))
+ if ((node == nullptr) || !XmlHaveChildContent(node))
return;
const std::string event = XML::getProperty(node, "event", "");
const std::string filename = XmlChildContent(node);
@@ -878,7 +878,7 @@ static void loadSoundRef(ItemInfo *const itemInfo, XmlNodeConstPtr node)
static void loadFloorSprite(SpriteDisplay &display,
XmlNodeConstPtrConst floorNode)
{
- if (!floorNode)
+ if (floorNode == nullptr)
return;
for_each_xml_child_node(spriteNode, floorNode)
{
@@ -902,7 +902,7 @@ static void loadFloorSprite(SpriteDisplay &display,
static void loadReplaceSprite(ItemInfo *const itemInfo,
XmlNodeConstPtr replaceNode)
{
- if (!replaceNode)
+ if (replaceNode == nullptr)
return;
const std::string removeSprite = XML::getProperty(
replaceNode, "sprite", "");
@@ -929,7 +929,7 @@ static void loadReplaceSprite(ItemInfo *const itemInfo,
{
IntMap *const mapList = itemInfo->addReplaceSprite(
parseSpriteName(removeSprite), f);
- if (!mapList)
+ if (mapList == nullptr)
continue;
for_each_xml_child_node(itemNode, replaceNode)
{
@@ -963,17 +963,17 @@ static void loadReplaceSprite(ItemInfo *const itemInfo,
const int to = XML::getProperty(itemNode, "to", 1);
IntMap *mapList = itemInfo->addReplaceSprite(
parseSpriteName(removeSprite), SpriteDirection::DOWN);
- if (mapList)
+ if (mapList != nullptr)
(*mapList)[from] = to;
mapList = itemInfo->addReplaceSprite(parseSpriteName(
removeSprite), SpriteDirection::DOWNLEFT);
- if (mapList)
+ if (mapList != nullptr)
(*mapList)[from] = to;
mapList = itemInfo->addReplaceSprite(parseSpriteName(
removeSprite), SpriteDirection::DOWNRIGHT);
- if (mapList)
+ if (mapList != nullptr)
(*mapList)[from] = to;
}
}
@@ -996,17 +996,17 @@ static void loadReplaceSprite(ItemInfo *const itemInfo,
const int to = XML::getProperty(itemNode, "to", 1);
IntMap *mapList = itemInfo->addReplaceSprite(
parseSpriteName(removeSprite), SpriteDirection::UP);
- if (mapList)
+ if (mapList != nullptr)
(*mapList)[from] = to;
mapList = itemInfo->addReplaceSprite(parseSpriteName(
removeSprite), SpriteDirection::UPLEFT);
- if (mapList)
+ if (mapList != nullptr)
(*mapList)[from] = to;
mapList = itemInfo->addReplaceSprite(parseSpriteName(
removeSprite), SpriteDirection::UPRIGHT);
- if (mapList)
+ if (mapList != nullptr)
(*mapList)[from] = to;
}
}
@@ -1016,7 +1016,7 @@ static void loadReplaceSprite(ItemInfo *const itemInfo,
{
IntMap *const mapList = itemInfo->addReplaceSprite(
parseSpriteName(removeSprite), direction);
- if (!mapList)
+ if (mapList == nullptr)
return;
for_each_xml_child_node(itemNode, replaceNode)
{
diff --git a/src/resources/db/itemfielddb.cpp b/src/resources/db/itemfielddb.cpp
index 65020e824..8a32ccc02 100644
--- a/src/resources/db/itemfielddb.cpp
+++ b/src/resources/db/itemfielddb.cpp
@@ -107,7 +107,7 @@ void ItemFieldDb::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "itemfields"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "itemfields"))
{
logger->log("ItemFieldDb: Error while loading %s!",
fileName.c_str());
diff --git a/src/resources/db/itemoptiondb.cpp b/src/resources/db/itemoptiondb.cpp
index 1199e07f7..bd78f95c5 100644
--- a/src/resources/db/itemoptiondb.cpp
+++ b/src/resources/db/itemoptiondb.cpp
@@ -88,7 +88,7 @@ void ItemOptionDb::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "itemoptions"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "itemoptions"))
{
if (skipError == SkipError_true)
{
diff --git a/src/resources/db/languagedb.cpp b/src/resources/db/languagedb.cpp
index b7e3ebc0e..a5443824e 100644
--- a/src/resources/db/languagedb.cpp
+++ b/src/resources/db/languagedb.cpp
@@ -52,7 +52,7 @@ void LanguageDb::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root || !xmlNameEqual(root, "languages"))
+ if ((root == nullptr) || !xmlNameEqual(root, "languages"))
{
delete doc;
return;
diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp
index d991e8273..e96f31e52 100644
--- a/src/resources/db/mapdb.cpp
+++ b/src/resources/db/mapdb.cpp
@@ -67,7 +67,7 @@ void MapDB::loadRemapXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root)
+ if (root == nullptr)
{
delete doc;
return;
@@ -101,7 +101,7 @@ void MapDB::loadRemapXmlFile(const std::string &fileName,
void MapDB::readMap(XmlNodePtrConst node)
{
- if (!node)
+ if (node == nullptr)
return;
const std::string map = XML::getProperty(node, "name", "");
if (map.empty())
@@ -121,7 +121,7 @@ void MapDB::readMap(XmlNodePtrConst node)
void MapDB::readAtlas(XmlNodePtrConst node)
{
- if (!node)
+ if (node == nullptr)
return;
const std::string atlas = XML::getProperty(node, "name", "");
if (atlas.empty())
@@ -154,7 +154,7 @@ void MapDB::loadInfo(const std::string &fileName,
UseVirtFs_true,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root)
+ if (root == nullptr)
{
delete doc;
return;
diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp
index bc1b20840..a528c7def 100644
--- a/src/resources/db/mercenarydb.cpp
+++ b/src/resources/db/mercenarydb.cpp
@@ -60,7 +60,7 @@ void MercenaryDB::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtr rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "mercenaries"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "mercenaries"))
{
logger->log("MercenaryDB: Error while loading %s!",
paths.getStringValue("mercenariesFile").c_str());
@@ -92,7 +92,7 @@ void MercenaryDB::loadXmlFile(const std::string &fileName,
logger->log("MercenaryDB: Redefinition of mercenary ID %d", id);
currentInfo = mMercenaryInfos[fromInt(id + offset, BeingTypeId)];
}
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new BeingInfo;
currentInfo->setBlockType(BlockType::NONE);
@@ -111,7 +111,7 @@ void MercenaryDB::loadXmlFile(const std::string &fileName,
currentInfo->setColorsList(XML::getProperty(mercenaryNode,
"colors", ""));
- if (currentInfo->getMaxHP())
+ if (currentInfo->getMaxHP() != 0)
currentInfo->setStaticMaxHP(true);
SpriteDisplay display;
diff --git a/src/resources/db/moddb.cpp b/src/resources/db/moddb.cpp
index 7a23e255f..5932d9b19 100644
--- a/src/resources/db/moddb.cpp
+++ b/src/resources/db/moddb.cpp
@@ -54,7 +54,7 @@ void ModDB::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "mods"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "mods"))
{
logger->log("Mods Database: Error while loading %s!",
fileName.c_str());
@@ -80,7 +80,7 @@ void ModDB::loadXmlFile(const std::string &fileName,
ModInfo *currentInfo = nullptr;
if (mModInfos.find(name) != mModInfos.end())
currentInfo = mModInfos[name];
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new ModInfo;
currentInfo->setName(name);
diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp
index 1ed0caa27..44b430144 100644
--- a/src/resources/db/monsterdb.cpp
+++ b/src/resources/db/monsterdb.cpp
@@ -62,7 +62,7 @@ void MonsterDB::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtr rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "monsters"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "monsters"))
{
logger->log("Monster Database: Error while loading %s!",
paths.getStringValue("monstersFile").c_str());
@@ -94,7 +94,7 @@ void MonsterDB::loadXmlFile(const std::string &fileName,
logger->log("MonsterDB: Redefinition of monster ID %d", id);
currentInfo = mMonsterInfos[fromInt(id + offset, BeingTypeId)];
}
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new BeingInfo;
currentInfo->setBlockType(BlockType::NONE);
@@ -114,7 +114,7 @@ void MonsterDB::loadXmlFile(const std::string &fileName,
currentInfo->setColorsList(XML::getProperty(monsterNode,
"colors", ""));
- if (currentInfo->getMaxHP())
+ if (currentInfo->getMaxHP() != 0)
currentInfo->setStaticMaxHP(true);
SpriteDisplay display;
diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp
index 9be217819..44a0bc747 100644
--- a/src/resources/db/npcdb.cpp
+++ b/src/resources/db/npcdb.cpp
@@ -63,7 +63,7 @@ void NPCDB::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "npcs"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "npcs"))
{
logger->log("NPC Database: Error while loading %s!",
paths.getStringValue("npcsFile").c_str());
@@ -99,7 +99,7 @@ void NPCDB::loadXmlFile(const std::string &fileName,
logger->log("NpcDB: Redefinition of npc ID %d", toInt(id, int));
currentInfo = mNPCInfos[id];
}
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new BeingInfo;
currentInfo->setTargetSelection(XML::getBoolProperty(npcNode,
@@ -198,7 +198,7 @@ BeingInfo *NPCDB::get(const BeingTypeId id)
BeingTypeId NPCDB::getAvatarFor(const BeingTypeId id)
{
const BeingInfo *const info = get(id);
- if (!info)
+ if (info == nullptr)
return BeingTypeId_zero;
return info->getAvatarId();
}
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index 76eaea7c5..7411faca9 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -155,7 +155,7 @@ void NpcDialogDB::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root)
+ if (root == nullptr)
{
delete doc;
return;
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index 5dca543a0..a47956e7f 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -61,7 +61,7 @@ void PETDB::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "pets"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "pets"))
{
logger->log("PET Database: Error while loading %s!",
fileName.c_str());
@@ -95,7 +95,7 @@ void PETDB::loadXmlFile(const std::string &fileName,
BeingInfo *currentInfo = nullptr;
if (mPETInfos.find(id) != mPETInfos.end())
currentInfo = mPETInfos[id];
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new BeingInfo;
currentInfo->setName(XML::langProperty(petNode,
diff --git a/src/resources/db/questdb.cpp b/src/resources/db/questdb.cpp
index 41b3b0062..db67e5138 100644
--- a/src/resources/db/questdb.cpp
+++ b/src/resources/db/questdb.cpp
@@ -54,7 +54,7 @@ void QuestDb::load()
static void loadQuest(const int var,
XmlNodeConstPtr node)
{
- if (!node)
+ if (node == nullptr)
return;
QuestItem *const quest = new QuestItem;
// TRANSLATORS: quests window quest name
@@ -85,7 +85,7 @@ static void loadQuest(const int var,
continue;
XmlChar *const data = reinterpret_cast<XmlChar*>(
XmlNodeGetContent(dataNode));
- if (!data)
+ if (data == nullptr)
continue;
std::string str = translator->getStr(data);
XmlFree(data);
@@ -181,7 +181,7 @@ void QuestDb::loadXmlFile(const std::string &fileName,
UseVirtFs_true,
skipError);
XmlNodeConstPtrConst root = doc.rootNode();
- if (!root)
+ if (root == nullptr)
return;
for_each_xml_child_node(varNode, root)
diff --git a/src/resources/db/skillunitdb.cpp b/src/resources/db/skillunitdb.cpp
index cec48a4a1..b5c4592ad 100644
--- a/src/resources/db/skillunitdb.cpp
+++ b/src/resources/db/skillunitdb.cpp
@@ -59,7 +59,7 @@ void SkillUnitDb::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "skillunits"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "skillunits"))
{
logger->log("SkillUnitDb: Error while loading %s!",
fileName.c_str());
@@ -94,7 +94,7 @@ void SkillUnitDb::loadXmlFile(const std::string &fileName,
BeingInfo *currentInfo = nullptr;
if (mSkillUnitInfos.find(id) != mSkillUnitInfos.end())
currentInfo = mSkillUnitInfos[id];
- if (!currentInfo)
+ if (currentInfo == nullptr)
currentInfo = new BeingInfo;
currentInfo->setName(XML::langProperty(skillUnitNode,
diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp
index d58a585ee..47eb99232 100644
--- a/src/resources/db/sounddb.cpp
+++ b/src/resources/db/sounddb.cpp
@@ -51,7 +51,7 @@ void SoundDB::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root || !xmlNameEqual(root, "sounds"))
+ if ((root == nullptr) || !xmlNameEqual(root, "sounds"))
{
delete doc;
return;
@@ -70,7 +70,7 @@ void SoundDB::loadXmlFile(const std::string &fileName,
{
const std::string name = XML::getProperty(node, "name", "");
const int id = NotifyManager::getIndexBySound(name);
- if (id)
+ if (id != 0)
{
const std::string value = XML::getProperty(node, "value", "");
mSounds[id] = value;
diff --git a/src/resources/db/statdb.cpp b/src/resources/db/statdb.cpp
index 12126f36a..7911009a3 100644
--- a/src/resources/db/statdb.cpp
+++ b/src/resources/db/statdb.cpp
@@ -175,7 +175,7 @@ void StatDb::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "stats"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "stats"))
{
logger->log("StatDb: Error while loading %s!",
fileName.c_str());
diff --git a/src/resources/db/statuseffectdb.cpp b/src/resources/db/statuseffectdb.cpp
index 58c5cf30d..d5fc96849 100644
--- a/src/resources/db/statuseffectdb.cpp
+++ b/src/resources/db/statuseffectdb.cpp
@@ -90,7 +90,7 @@ void StatusEffectDB::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtrConst rootNode = doc.rootNode();
- if (!rootNode || !xmlNameEqual(rootNode, "status-effects"))
+ if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "status-effects"))
{
logger->log("Error loading status effects file: " + fileName);
return;
@@ -151,9 +151,9 @@ void StatusEffectDB::loadXmlFile(const std::string &fileName,
StatusEffect *endEffect = statusEffects[0][id];
const std::string name = XML::getProperty(node, "name", "");
const std::string name2 = XML::langProperty(node, "name", "");
- if (!startEffect)
+ if (startEffect == nullptr)
startEffect = new StatusEffect;
- if (!endEffect)
+ if (endEffect == nullptr)
endEffect = new StatusEffect;
startEffect->mName = name2;
diff --git a/src/resources/db/textdb.cpp b/src/resources/db/textdb.cpp
index 24a5f2a38..e4d0b9b65 100644
--- a/src/resources/db/textdb.cpp
+++ b/src/resources/db/textdb.cpp
@@ -49,7 +49,7 @@ void TextDb::loadXmlFile(const std::string &fileName,
skipError);
XmlNodeConstPtrConst root = doc->rootNode();
- if (!root || !xmlNameEqual(root, "texts"))
+ if ((root == nullptr) || !xmlNameEqual(root, "texts"))
{
delete doc;
return;
diff --git a/src/resources/db/unitsdb.cpp b/src/resources/db/unitsdb.cpp
index 0437c81e4..9481406c4 100644
--- a/src/resources/db/unitsdb.cpp
+++ b/src/resources/db/unitsdb.cpp
@@ -193,7 +193,7 @@ void UnitsDb::loadXmlFile(const std::string &fileName,
XML::Document doc(fileName, UseVirtFs_true, skipError);
XmlNodeConstPtrConst root = doc.rootNode();
- if (!root || !xmlNameEqual(root, "units"))
+ if ((root == nullptr) || !xmlNameEqual(root, "units"))
{
logger->log("Error loading unit definition file: "
+ paths.getStringValue("unitsFile"));
@@ -259,7 +259,7 @@ static std::string formatUnit(const int value,
int levelAmount = CAST_S32(amount);
int nextAmount = 0;
- if (ul.count)
+ if (ul.count != 0)
levelAmount /= ul.count;
amount -= static_cast<double>(levelAmount * ul.count);
@@ -275,7 +275,7 @@ static std::string formatUnit(const int value,
pl = ul;
ul = ud.levels[i];
- if (ul.count)
+ if (ul.count != 0)
{
nextAmount = levelAmount / ul.count;
levelAmount %= ul.count;
@@ -287,7 +287,7 @@ static std::string formatUnit(const int value,
pl.separator).append(pl.symbol).append(output);
}
- if (!nextAmount)
+ if (nextAmount == 0)
break;
levelAmount = nextAmount;
}
@@ -305,7 +305,7 @@ static std::string formatUnit(const int value,
ul = ud.levels[i - 1];
break;
}
- if (ul.count)
+ if (ul.count != 0)
amount /= ul.count;
}