diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-03 15:09:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-03 17:03:33 +0300 |
commit | 9d33bb1bdaf0f19ccaa742a316af9620b05b825d (patch) | |
tree | 19949d567f0bbf4017475ffd824be66b36b5f7b9 /src/resources/db/itemdb.cpp | |
parent | 284acf8f76bd2201bd64b847a2564206f77a4278 (diff) | |
download | mv-9d33bb1bdaf0f19ccaa742a316af9620b05b825d.tar.gz mv-9d33bb1bdaf0f19ccaa742a316af9620b05b825d.tar.bz2 mv-9d33bb1bdaf0f19ccaa742a316af9620b05b825d.tar.xz mv-9d33bb1bdaf0f19ccaa742a316af9620b05b825d.zip |
Add into items.xml option useButton.
For now unused.
Diffstat (limited to 'src/resources/db/itemdb.cpp')
-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 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( |