diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/itemdb.cpp | 11 | ||||
-rw-r--r-- | src/resources/itemdb.h | 2 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 28 |
3 files changed, 28 insertions, 13 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index d60e38da..4638f00e 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -78,6 +78,8 @@ static ItemType itemTypeFromString(const std::string &name, int id = 0) else if (name=="equip-necklace") return ITEM_EQUIPMENT_NECKLACE; else if (name=="equip-feet") return ITEM_EQUIPMENT_FEET; else if (name=="equip-ammo") return ITEM_EQUIPMENT_AMMO; + else if (name=="racesprite") return ITEM_SPRITE_RACE; + else if (name=="hairsprite") return ITEM_SPRITE_HAIR; else return ITEM_UNUSABLE; } @@ -255,6 +257,15 @@ void ItemDB::unload() mLoaded = false; } +bool ItemDB::exists(int id) +{ + assert(mLoaded); + + ItemInfos::const_iterator i = mItemInfos.find(id); + + return i != mItemInfos.end(); +} + const ItemInfo &ItemDB::get(int id) { assert(mLoaded); diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h index 63c016ba..be023073 100644 --- a/src/resources/itemdb.h +++ b/src/resources/itemdb.h @@ -43,6 +43,8 @@ namespace ItemDB */ void unload(); + bool exists(int id); + const ItemInfo &get(int id); const ItemInfo &get(const std::string &name); diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index e14d62b8..a7c0ddca 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -72,19 +72,21 @@ enum EquipmentSlot enum ItemType { ITEM_UNUSABLE = 0, - ITEM_USABLE, // 1 - ITEM_EQUIPMENT_ONE_HAND_WEAPON, // 2 - ITEM_EQUIPMENT_TWO_HANDS_WEAPON,// 3 - ITEM_EQUIPMENT_TORSO,// 4 - ITEM_EQUIPMENT_ARMS,// 5 - ITEM_EQUIPMENT_HEAD,// 6 - ITEM_EQUIPMENT_LEGS,// 7 - ITEM_EQUIPMENT_SHIELD,// 8 - ITEM_EQUIPMENT_RING,// 9 - ITEM_EQUIPMENT_NECKLACE,// 10 - ITEM_EQUIPMENT_FEET,// 11 - ITEM_EQUIPMENT_AMMO,// 12 - ITEM_EQUIPMENT_CHARM// 13 + ITEM_USABLE, + ITEM_EQUIPMENT_ONE_HAND_WEAPON, + ITEM_EQUIPMENT_TWO_HANDS_WEAPON, + ITEM_EQUIPMENT_TORSO, + ITEM_EQUIPMENT_ARMS, // 5 + ITEM_EQUIPMENT_HEAD, + ITEM_EQUIPMENT_LEGS, + ITEM_EQUIPMENT_SHIELD, + ITEM_EQUIPMENT_RING, + ITEM_EQUIPMENT_NECKLACE, // 10 + ITEM_EQUIPMENT_FEET, + ITEM_EQUIPMENT_AMMO, + ITEM_EQUIPMENT_CHARM, + ITEM_SPRITE_RACE, + ITEM_SPRITE_HAIR // 15 }; /** |