summaryrefslogtreecommitdiff
path: root/src/resources/itemdb.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-04-16 12:10:25 -0600
committerJared Adams <jaxad0127@gmail.com>2009-04-16 12:13:54 -0600
commitb04dd091b9f9e2ff366fc3a5882289df72e2efd9 (patch)
tree7033bc4ffc8bbe9f3d0c887198a3c6fe067f1a21 /src/resources/itemdb.cpp
parent255c491375005abb1d2de22fa5aa1a821ac3a4f6 (diff)
downloadmana-client-b04dd091b9f9e2ff366fc3a5882289df72e2efd9.tar.gz
mana-client-b04dd091b9f9e2ff366fc3a5882289df72e2efd9.tar.bz2
mana-client-b04dd091b9f9e2ff366fc3a5882289df72e2efd9.tar.xz
mana-client-b04dd091b9f9e2ff366fc3a5882289df72e2efd9.zip
Remove last support #ifdef in the resource code
Diffstat (limited to 'src/resources/itemdb.cpp')
-rw-r--r--src/resources/itemdb.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 036bdea8..36be4d0c 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -56,6 +56,13 @@ static char const *const fields[][2] =
{ "mp", N_("MP %+d") }
};
+static std::list<ItemDB::Stat*> extraStats;
+
+void ItemDB::setStatsList(std::list<ItemDB::Stat*> stats)
+{
+ extraStats = stats;
+}
+
static ItemType itemTypeFromString(const std::string &name, int id = 0)
{
if (name=="generic") return ITEM_UNUSABLE;
@@ -149,7 +156,6 @@ void ItemDB::load()
itemInfo->setWeaponType(weaponType);
itemInfo->setAttackRange(attackRange);
-#ifdef TMWSERV_SUPPORT
std::string effect;
for (int i = 0; i < int(sizeof(fields) / sizeof(fields[0])); ++i)
{
@@ -158,12 +164,20 @@ void ItemDB::load()
if (!effect.empty()) effect += " / ";
effect += strprintf(gettext(fields[i][1]), value);
}
-#else
- std::string effect = XML::getProperty(node, "effect", "");
-#endif
+ for (std::list<Stat*>::iterator it = extraStats.begin();
+ it != extraStats.end(); it++)
+ {
+ int value = XML::getProperty(node, (*it)->tag.c_str(), 0);
+ if (!value) continue;
+ if (!effect.empty()) effect += " / ";
+ effect += strprintf((*it)->format.c_str(), value);
+ }
+ std::string temp = XML::getProperty(node, "effect", "");
+ if (!effect.empty() && !temp.empty())
+ effect += " / ";
+ effect += temp;
itemInfo->setEffect(effect);
-
for_each_xml_child_node(itemChild, node)
{
if (xmlStrEqual(itemChild->name, BAD_CAST "sprite"))