From bfd5338c20fcd838f711ea5e96b2f37e012dc884 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 27 Jan 2017 19:59:11 +0300 Subject: Move links replace code from browserbox into browserboxtools. --- src/gui/widgets/browserbox.cpp | 82 +----------------------------------------- 1 file changed, 1 insertion(+), 81 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index bd565b3d6..b1793b725 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -23,16 +23,8 @@ #include "gui/widgets/browserbox.h" -#include "itemcolormanager.h" -#include "main.h" -#include "settings.h" - -#include "const/resources/item/cards.h" - #include "enums/gui/linkhighlightmode.h" -#include "input/inputmanager.h" - #include "gui/gui.h" #include "gui/skin.h" @@ -42,17 +34,6 @@ #include "render/graphics.h" -#ifndef DYECMD -#include "resources/beinginfo.h" -#include "resources/iteminfo.h" - -#include "resources/db/homunculusdb.h" -#include "resources/db/itemdb.h" -#include "resources/db/mercenarydb.h" -#include "resources/db/monsterdb.h" -#include "resources/db/petdb.h" -#endif // DYECMD - #include "resources/imageset.h" #include "resources/image/image.h" @@ -248,68 +229,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) bLink.y2 = bLink.y1 + font->getHeight(); if (bLink.caption.empty()) { - bLink.caption = bLink.link; -#ifndef DYECMD - const std::string link = bLink.link; - if (!link.empty() && link[0] == 'm') - { // monster link - const BeingTypeId id = static_cast( - atoi(bLink.link.substr(1).c_str())); - BeingInfo *info = MonsterDB::get(id); - if (info) - bLink.caption = info->getName(); - } - else if (!link.empty() && link[0] == 'p') - { // pet link - const BeingTypeId id = static_cast( - atoi(bLink.link.substr(1).c_str())); - BeingInfo *info = PETDB::get(id); - if (info) - bLink.caption = info->getName(); - } - else if (!link.empty() && link[0] == 'h') - { // homunculus link - const BeingTypeId id = static_cast( - atoi(bLink.link.substr(1).c_str())); - BeingInfo *info = HomunculusDB::get(id); - if (info) - bLink.caption = info->getName(); - } - else if (!link.empty() && link[0] == 'M') - { // homunculus link - const BeingTypeId id = static_cast( - atoi(bLink.link.substr(1).c_str())); - BeingInfo *info = MercenaryDB::get(id); - if (info) - bLink.caption = info->getName(); - } - else - { // item link - size_t idx = bLink.link.find(','); - if (idx != std::string::npos) - { - const int id = atoi(bLink.link.substr(0, idx).c_str()); - if (id) - { - std::vector parts; - splitToIntVector(parts, - bLink.link.substr(idx), ','); - while (parts.size() < maxCards) - parts.push_back(0); - const ItemColor itemColor = - ItemColorManager::getColorFromCards(&parts[0]); - bLink.caption = ItemDB::get(id).getName(itemColor); - } - } - else - { - const int id = atoi(bLink.link.c_str()); - if (id) - bLink.caption = ItemDB::get(id).getName(); - } - } -#endif // DYECMD - + bLink.caption = BrowserBoxTools::replaceLinkCommands(bLink.link); if (translator) bLink.caption = translator->getStr(bLink.caption); } -- cgit v1.2.3-60-g2f50