From 87dc57caff1b01f4abe2cc14bfc56f5bc130fbb6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 3 Jul 2014 18:00:02 +0300 Subject: Add item attribute useButton2 and use it in inventory. --- src/resources/db/itemdb.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/resources/db') 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( -- cgit v1.2.3-60-g2f50