summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-01 15:13:10 +0300
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-06-25 16:03:45 +0200
commit581f56463f6ecf7d72d56106e3893aa549790144 (patch)
tree5eed18a402e64de23932e55e1a44d75988088cb1
parent1beebda470d6665df30c9f165f075067a47ad97d (diff)
downloadmana-581f56463f6ecf7d72d56106e3893aa549790144.tar.gz
mana-581f56463f6ecf7d72d56106e3893aa549790144.tar.bz2
mana-581f56463f6ecf7d72d56106e3893aa549790144.tar.xz
mana-581f56463f6ecf7d72d56106e3893aa549790144.zip
Show item links with empty item name.
(cherry picked from commit 0192d44d46dcf948ab26371862753f4baf5aae4e)
-rw-r--r--src/gui/widgets/browserbox.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index f21a4e16..64b494db 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -28,6 +28,8 @@
#include "gui/truetypefont.h"
#include "gui/widgets/linkhandler.h"
+#include "resources/itemdb.h"
+#include "resources/iteminfo.h"
#include "resources/theme.h"
#include <guichan/graphics.hpp>
@@ -96,6 +98,15 @@ void BrowserBox::addRow(const std::string &row)
link.link = tmp.substr(idx1 + 2, idx2 - (idx1 + 2));
link.caption = tmp.substr(idx2 + 1, idx3 - (idx2 + 1));
+ if (link.caption.empty())
+ {
+ const int id = atoi(link.link.c_str());
+ if (id)
+ link.caption = itemDb->get(id).getName();
+ else
+ link.caption = link.link;
+ }
+
newRow.text += tmp.substr(0, idx1);
newRow.text += "##<" + link.caption;