From 9d33bb1bdaf0f19ccaa742a316af9620b05b825d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 3 Jul 2014 15:09:13 +0300 Subject: Add into items.xml option useButton. For now unused. --- 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 f40fdbbd6..0cad05f39 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -126,6 +126,19 @@ static ItemType::Type itemTypeFromString(const std::string &name) return ItemType::UNUSABLE; } +static std::string useButtonFromItemType(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.useButton.c_str()); + } + logger->log("Unknown item type"); + return std::string(); +} + static void initStatic() { mConstructed = true; @@ -243,6 +256,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) const int pet = XML::getProperty(node, "pet", 0); const int maxFloorOffset = XML::getIntProperty( node, "maxFloorOffset", mapTileSize, 0, mapTileSize); + std::string useButton = XML::getProperty(node, "useButton", ""); std::string colors; if (serverVersion >= 1) { @@ -291,6 +305,9 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) itemInfo->setName(name.empty() ? _("unnamed") : name); itemInfo->setDescription(description); itemInfo->setType(itemTypeFromString(typeStr)); + if (useButton.empty()) + useButton = useButtonFromItemType(itemInfo->getType()); + itemInfo->setUseButton(useButton); itemInfo->addTag(mTags["All"]); itemInfo->setPet(pet); itemInfo->setProtected(XML::getBoolProperty( -- cgit v1.2.3-60-g2f50