aboutsummaryrefslogtreecommitdiff
path: root/src/guiFormSpecMenu.cpp
diff options
context:
space:
mode:
authorrubenwardy <rubenwardy@gmail.com>2017-02-03 22:28:09 +0000
committerrubenwardy <rubenwardy@gmail.com>2017-02-04 22:07:55 +0000
commitf2f9a923515386d787a245fac52f78e815b3a839 (patch)
tree4493917a60f3ea682a25d93e4f8a994b69044e81 /src/guiFormSpecMenu.cpp
parentf2aa2c6a986dec47856c49ae5f54fbf3c688e027 (diff)
downloadminetest-f2f9a923515386d787a245fac52f78e815b3a839.tar.gz
minetest-f2f9a923515386d787a245fac52f78e815b3a839.tar.bz2
minetest-f2f9a923515386d787a245fac52f78e815b3a839.zip
Add per-stack descriptions using ItemStack Metadata
Diffstat (limited to 'src/guiFormSpecMenu.cpp')
-rw-r--r--src/guiFormSpecMenu.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 45b0e9c11..67b3a9ad0 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -2303,7 +2303,12 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase,
// Draw tooltip
std::wstring tooltip_text = L"";
if (hovering && !m_selected_item) {
- tooltip_text = utf8_to_wide(item.getDefinition(m_client->idef()).description);
+ const std::string &desc = item.metadata.getString("description");
+ if (desc.empty())
+ tooltip_text =
+ utf8_to_wide(item.getDefinition(m_client->idef()).description);
+ else
+ tooltip_text = utf8_to_wide(desc);
}
if (tooltip_text != L"") {
std::vector<std::wstring> tt_rows = str_split(tooltip_text, L'\n');