diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2007-04-22 13:56:15 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2007-04-22 13:56:15 +0000 |
commit | ab072dddb231895ba7b6762eda9fa70af961b0fb (patch) | |
tree | 3cd32749965be8d07baeb1b07d6d331dfcec2fb5 /src/resources/itemdb.cpp | |
parent | 9398626764574fa536dca3806490f88970d2f056 (diff) | |
download | mana-ab072dddb231895ba7b6762eda9fa70af961b0fb.tar.gz mana-ab072dddb231895ba7b6762eda9fa70af961b0fb.tar.bz2 mana-ab072dddb231895ba7b6762eda9fa70af961b0fb.tar.xz mana-ab072dddb231895ba7b6762eda9fa70af961b0fb.zip |
Made the itemdb parameter checks more terse and manageable.
Diffstat (limited to 'src/resources/itemdb.cpp')
-rw-r--r-- | src/resources/itemdb.cpp | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 6e0ecce9..70ead6ab 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -102,55 +102,26 @@ void ItemDB::load() mItemInfos[id] = itemInfo;
}
-
if (id == 0)
{
logger->log("ItemDB: An item has no ID in items.xml!");
}
- if (name == "")
- {
- logger->log("ItemDB: Missing name for item %d!", id);
- }
- if (image == "")
- {
- logger->log("ItemDB: Missing image parameter for item: %i. %s",
- id, name.c_str());
- }
- /*
- if (art == 0)
- {
- logger->log("Item Manager: Missing art parameter for item: %i. %s",
- id, name.c_str());
- }
- if (description == "")
- {
- logger->log("ItemDB: Missing description parameter for item: %i. %s",
- id, name.c_str());
- }
- if (effect == "")
- {
- logger->log("ItemDB: Missing effect parameter for item: %i. %s",
- id, name.c_str());
- }
- if (type == 0)
- {
- logger->log("Item Manager: Missing type parameter for item: %i. %s",
- id, name.c_str());
- }
- */
- if (weight == 0)
- {
- logger->log("Item Manager: Missing weight parameter for item: %i. %s",
- id, name.c_str());
- }
- /*
- if (slot == 0)
- {
- logger->log("Item Manager: Missing slot parameter for item: %i. %s",
- id, name.c_str());
- }
- */
+#define CHECK_PARAM(param, error_value) \
+ if (param == error_value) \
+ logger->log("ItemDB: Missing" #param " parameter for item %i! %s", \
+ id, name.c_str())
+
+ CHECK_PARAM(name, "");
+ CHECK_PARAM(image, "");
+ // CHECK_PARAM(art, 0);
+ // CHECK_PARAM(description, "");
+ // CHECK_PARAM(effect, "");
+ // CHECK_PARAM(type, 0);
+ CHECK_PARAM(weight, 0);
+ // CHECK_PARAM(slot, 0);
+
+#undef CHECK_PARAM
}
xmlFreeDoc(doc);
|