diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-10 11:41:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-10 14:06:42 +0300 |
commit | ad5bfca7d5df9201e5460e68ca149674bac5ac2c (patch) | |
tree | ad852ef64385bc07349a03bda66d318bb960ddd4 /src | |
parent | 574efa8ae89f7786239753537eb32c222686f4a1 (diff) | |
download | manaverse-ad5bfca7d5df9201e5460e68ca149674bac5ac2c.tar.gz manaverse-ad5bfca7d5df9201e5460e68ca149674bac5ac2c.tar.bz2 manaverse-ad5bfca7d5df9201e5460e68ca149674bac5ac2c.tar.xz manaverse-ad5bfca7d5df9201e5460e68ca149674bac5ac2c.zip |
Show name on named items.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/popups/itempopup.cpp | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index a9afe136a..56e907620 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -23,10 +23,13 @@ #include "gui/popups/itempopup.h" +#include "actormanager.h" #include "configuration.h" #include "item.h" #include "units.h" +#include "being/being.h" + #include "gui/gui.h" #include "gui/fonts/font.h" @@ -41,6 +44,7 @@ #include "resources/iteminfo.h" #include "resources/resourcemanager.h" +#include "net/beinghandler.h" #include "net/serverfeatures.h" #include "debug.h" @@ -267,21 +271,48 @@ std::string ItemPopup::getCardsString(const int *const cards) std::string label; - for (int f = 0; f < maxCards; f ++) + switch (cards[0]) { - const int id = cards[f]; - if (id) + case 0xfe: // named item + { + const int32_t charId = cards[2] + 65536 * cards[3]; + std::string name = actorManager->findCharById(charId); + if (name.empty()) + { + name = toString(charId); + beingHandler->requestNameByCharId(charId); + } + // TRANSLATORS: named item description + label.append(strprintf(_("Item named: %s"), name.c_str())); + return label; + } + case 0x00FFU: // forged item + { + return label; + } + case 0xFF00U: { - if (!label.empty()) - label.append(" / "); - const ItemInfo &info = ItemDB::get(id); - label.append(info.getName()); + return label; + } + default: + { + for (int f = 0; f < maxCards; f ++) + { + const int id = cards[f]; + if (id) + { + if (!label.empty()) + label.append(" / "); + const ItemInfo &info = ItemDB::get(id); + label.append(info.getName()); + } + } + if (label.empty()) + return label; + // TRANSLATORS: popup label + return _("Cards: ") + label; } } - if (label.empty()) - return label; - // TRANSLATORS: popup label - return _("Cards: ") + label; } #define caseSetColor(name1, name2) \ |