summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/resources/itemdb.cpp59
2 files changed, 17 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index 754901e6..61aef963 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
src/resources/itemdb.cpp, src/resources/equipmentdb.cpp: Added a macro
for XML child node iterations to make the code more terse and easier
to read.
+ * src/resources/itemdb.cpp: Made the parameter checks more terse and
+ manageable.
2007-04-13 Björn Steinbrink <B.Steinbrink@gmx.de>
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);