summaryrefslogtreecommitdiff
path: root/src/gui/widgets/browserbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-14 23:55:23 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-15 14:36:47 +0300
commitca2f3bafe8815e5cba06426f24ef7acad6e699f4 (patch)
treef2200bf5952fbc946132ec179ab14e0752329cdf /src/gui/widgets/browserbox.cpp
parent92b448fa3bcc2057552410a69c88c1683c6edba8 (diff)
downloadmv-ca2f3bafe8815e5cba06426f24ef7acad6e699f4.tar.gz
mv-ca2f3bafe8815e5cba06426f24ef7acad6e699f4.tar.bz2
mv-ca2f3bafe8815e5cba06426f24ef7acad6e699f4.tar.xz
mv-ca2f3bafe8815e5cba06426f24ef7acad6e699f4.zip
Add support for show cards in links.
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r--src/gui/widgets/browserbox.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 14dd95ba3..9ffead378 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -23,6 +23,7 @@
#include "gui/widgets/browserbox.h"
+#include "itemcolormanager.h"
#include "settings.h"
#include "input/inputmanager.h"
@@ -235,13 +236,30 @@ 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 int id = atoi(bLink.link.c_str());
- if (id)
- bLink.caption = ItemDB::get(id).getName();
+ 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<int> parts;
+ splitToIntVector(parts, bLink.link.substr(idx), ',');
+ while (parts.size() < 4)
+ 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
- bLink.caption = bLink.link;
if (translator)
bLink.caption = translator->getStr(bLink.caption);
}