From 7e66a4606bb15d98197f71245fe191d03152ee5f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Feb 2016 23:02:06 +0300 Subject: Improve some empty string checks. --- src/resources/db/itemdb.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/resources/db') 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 } -- cgit v1.2.3-60-g2f50