summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-06-07 18:39:24 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-06-07 18:52:06 +0200
commitbe64806b1f8f3da2459771e268fd839ee04aa7ba (patch)
tree819eb073f522195e3ddfe8750e0a722c01a91bba
parent91f54b7fc9c1ad35316575ef10983a0eabafbe83 (diff)
downloadmana-be64806b1f8f3da2459771e268fd839ee04aa7ba.tar.gz
mana-be64806b1f8f3da2459771e268fd839ee04aa7ba.tar.bz2
mana-be64806b1f8f3da2459771e268fd839ee04aa7ba.tar.xz
mana-be64806b1f8f3da2459771e268fd839ee04aa7ba.zip
Merged the unknown item definition loading
and added the default hit effects on it. Reviewed-by: Jaxad0127.
-rw-r--r--src/resources/itemdb.cpp23
-rw-r--r--src/resources/itemdb.h7
2 files changed, 19 insertions, 11 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index e913bb0a..b9dd8e83 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -64,6 +64,17 @@ static ItemType itemTypeFromString(const std::string &name, int id = 0)
else return ITEM_UNUSABLE;
}
+void ItemDB::loadEmptyItemDefinition()
+{
+ mUnknown->mName = _("Unknown item");
+ mUnknown->mDisplay = SpriteDisplay();
+ std::string errFile = paths.getStringValue("spriteErrorFile");
+ mUnknown->setSprite(errFile, GENDER_MALE);
+ mUnknown->setSprite(errFile, GENDER_FEMALE);
+ mUnknown->setHitEffectId(paths.getIntValue("hitEffectId"));
+ mUnknown->setCriticalHitEffectId(paths.getIntValue("criticalHitEffectId"));
+}
+
/*
* Common itemDB functions
*/
@@ -321,11 +332,7 @@ void TaItemDB::load()
logger->log("Initializing TmwAthena item database...");
mUnknown = new TaItemInfo;
- mUnknown->mName = _("Unknown item");
- mUnknown->mDisplay = SpriteDisplay();
- std::string errFile = paths.getStringValue("spriteErrorFile");
- mUnknown->setSprite(errFile, GENDER_MALE);
- mUnknown->setSprite(errFile, GENDER_FEMALE);
+ loadEmptyItemDefinition();
XML::Document doc(ITEMS_DB_FILE);
xmlNodePtr rootNode = doc.rootNode();
@@ -422,11 +429,7 @@ void ManaServItemDB::load()
logger->log("Initializing ManaServ item database...");
mUnknown = new ManaServItemInfo;
- mUnknown->mName = _("Unknown item");
- mUnknown->mDisplay = SpriteDisplay();
- std::string errFile = paths.getStringValue("spriteErrorFile");
- mUnknown->setSprite(errFile, GENDER_MALE);
- mUnknown->setSprite(errFile, GENDER_FEMALE);
+ loadEmptyItemDefinition();
XML::Document doc(ITEMS_DB_FILE);
xmlNodePtr rootNode = doc.rootNode();
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index aa6e62c0..80f4bea9 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -115,10 +115,15 @@ class ItemDB
virtual void checkItemInfo(ItemInfo* itemInfo);
/**
- * Register the item to mItemInfos and mNamedItemsInfos
+ * Registers the item to mItemInfos and mNamedItemsInfos
*/
void addItem(ItemInfo *itemInfo);
+ /**
+ * Loads the empty item definition.
+ */
+ void loadEmptyItemDefinition();
+
// Default unknown reference
ItemInfo *mUnknown;