diff options
-rw-r--r-- | src/resources/itemdb.cpp | 23 | ||||
-rw-r--r-- | src/resources/itemdb.h | 7 |
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; |