diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-03 18:00:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-03 18:00:02 +0300 |
commit | 87dc57caff1b01f4abe2cc14bfc56f5bc130fbb6 (patch) | |
tree | 926e4cf6c72f2b9f7ada2a715ca79adc88a53157 /src/resources/db | |
parent | 3a9f3469e65e1c45a8cdf9c6ae21e73c90b87d22 (diff) | |
download | mv-87dc57caff1b01f4abe2cc14bfc56f5bc130fbb6.tar.gz mv-87dc57caff1b01f4abe2cc14bfc56f5bc130fbb6.tar.bz2 mv-87dc57caff1b01f4abe2cc14bfc56f5bc130fbb6.tar.xz mv-87dc57caff1b01f4abe2cc14bfc56f5bc130fbb6.zip |
Add item attribute useButton2 and use it in inventory.
Diffstat (limited to 'src/resources/db')
-rw-r--r-- | src/resources/db/itemdb.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 0cad05f39..080254bb0 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -139,6 +139,19 @@ static std::string useButtonFromItemType(const ItemType::Type &type) return std::string(); } +static std::string useButton2FromItemType(const ItemType::Type &type) +{ + const size_t sz = sizeof(itemTypeMap) / sizeof(itemTypeMap[0]); + for (size_t f = 0; f < sz; f ++) + { + const ItemTypeMap &item = itemTypeMap[f]; + if (item.type == type) + return gettext(item.useButton2.c_str()); + } + logger->log("Unknown item type"); + return std::string(); +} + static void initStatic() { mConstructed = true; @@ -257,6 +270,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) const int maxFloorOffset = XML::getIntProperty( node, "maxFloorOffset", mapTileSize, 0, mapTileSize); std::string useButton = XML::getProperty(node, "useButton", ""); + std::string useButton2 = XML::getProperty(node, "useButton2", ""); std::string colors; if (serverVersion >= 1) { @@ -308,6 +322,9 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) if (useButton.empty()) useButton = useButtonFromItemType(itemInfo->getType()); itemInfo->setUseButton(useButton); + if (useButton2.empty()) + useButton2 = useButton2FromItemType(itemInfo->getType()); + itemInfo->setUseButton2(useButton2); itemInfo->addTag(mTags["All"]); itemInfo->setPet(pet); itemInfo->setProtected(XML::getBoolProperty( |