summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-08 23:02:06 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-08 23:02:06 +0300
commit7e66a4606bb15d98197f71245fe191d03152ee5f (patch)
tree825022571cfb55d70f1ca3c142f79db3758fb72b /src/resources
parenta61ac4664d55cddb18d2d861e76629bd07676129 (diff)
downloadmv-7e66a4606bb15d98197f71245fe191d03152ee5f.tar.gz
mv-7e66a4606bb15d98197f71245fe191d03152ee5f.tar.bz2
mv-7e66a4606bb15d98197f71245fe191d03152ee5f.tar.xz
mv-7e66a4606bb15d98197f71245fe191d03152ee5f.zip
Improve some empty string checks.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/itemdb.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index ba5631293..d07301e88 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -357,7 +357,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
SpriteDisplay display;
display.image = image;
- if (floor != "")
+ if (!floor.empty())
display.floor = floor;
else
display.floor = image;
@@ -447,7 +447,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
}
for (int f = 0; f < 3; f++)
{
- if (tags[f] != "")
+ if (!tags[f].empty())
{
if (mTags.find(tags[f]) == mTags.end())
{
@@ -624,16 +624,18 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
}
}
-#define CHECK_PARAM(param, error_value) \
- if (param == error_value) \
+#define CHECK_PARAM(param) \
+ if (param.empty()) \
+ { \
logger->log("ItemDB: Missing " #param " attribute for item %i!", \
- id)
+ id); \
+ }
if (id >= 0 && typeStr != "other")
{
- CHECK_PARAM(name, "");
- CHECK_PARAM(description, "");
- CHECK_PARAM(image, "");
+ CHECK_PARAM(name)
+ CHECK_PARAM(description)
+ CHECK_PARAM(image)
}
#undef CHECK_PARAM
}