summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemlinkhandler.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/itemlinkhandler.cpp
parent92b448fa3bcc2057552410a69c88c1683c6edba8 (diff)
downloadmanaverse-ca2f3bafe8815e5cba06426f24ef7acad6e699f4.tar.gz
manaverse-ca2f3bafe8815e5cba06426f24ef7acad6e699f4.tar.bz2
manaverse-ca2f3bafe8815e5cba06426f24ef7acad6e699f4.tar.xz
manaverse-ca2f3bafe8815e5cba06426f24ef7acad6e699f4.zip
Add support for show cards in links.
Diffstat (limited to 'src/gui/widgets/itemlinkhandler.cpp')
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 3b31ea553..1f30c5da6 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -22,6 +22,8 @@
#include "gui/widgets/itemlinkhandler.h"
+#include "itemcolormanager.h"
+
#include "gui/viewport.h"
#include "gui/popups/itempopup.h"
@@ -111,14 +113,19 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
splitToIntVector(str, link, ',');
if (str.empty())
return;
- ItemColor color = ItemColor_one;
- if (str.size() > 1)
- color = fromInt(str[1], ItemColor);
+
const int id = str[0];
+
if (id > 0)
{
+ str.erase(str.begin());
+ while (str.size() < 4)
+ str.push_back(0);
+ const ItemColor color =
+ ItemColorManager::getColorFromCards(&str[0]);
+
const ItemInfo &itemInfo = ItemDB::get(id);
- itemPopup->setItem(itemInfo, color, true, -1, nullptr);
+ itemPopup->setItem(itemInfo, color, true, -1, &str[0]);
if (itemPopup->isPopupVisible())
{
itemPopup->setVisible(Visible_false);