aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-03-10 16:22:56 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2015-03-11 14:33:07 +0100
commit140245a76f9b73b1f981176ce4a77d45b1edc933 (patch)
tree799da42bbcfc35f8d805613f807a5631f6060f1d
parent29e46d6b29a50151785cd96f70eed957e2b075f3 (diff)
downloadminetest-140245a76f9b73b1f981176ce4a77d45b1edc933.tar.gz
minetest-140245a76f9b73b1f981176ce4a77d45b1edc933.tar.bz2
minetest-140245a76f9b73b1f981176ce4a77d45b1edc933.zip
Unescape tooltip texts
Previously, tooltips didn't unescape escaped formspec texts. Item descriptions that trigger tooltips like inside inventories or for item_image_button don't need to get unescaped, as they don't get set using formspec, but from lua.
-rw-r--r--src/guiFormSpecMenu.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 265d6c72d..d25b6cdf9 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -1432,7 +1432,7 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
m_tooltips[narrow_to_wide(name)] =
- TooltipSpec (item.getDefinition(idef).description,
+ TooltipSpec(item.getDefinition(idef).description,
m_default_tooltip_bgcolor,
m_default_tooltip_color);
@@ -1550,13 +1550,15 @@ void GUIFormSpecMenu::parseTooltip(parserData* data, std::string element)
std::vector<std::string> parts = split(element,';');
if (parts.size() == 2) {
std::string name = parts[0];
- m_tooltips[narrow_to_wide(name)] = TooltipSpec (parts[1], m_default_tooltip_bgcolor, m_default_tooltip_color);
+ m_tooltips[narrow_to_wide(name)] = TooltipSpec(unescape_string(parts[1]),
+ m_default_tooltip_bgcolor, m_default_tooltip_color);
return;
} else if (parts.size() == 4) {
std::string name = parts[0];
video::SColor tmp_color1, tmp_color2;
if ( parseColorString(parts[2], tmp_color1, false) && parseColorString(parts[3], tmp_color2, false) ) {
- m_tooltips[narrow_to_wide(name)] = TooltipSpec (parts[1], tmp_color1, tmp_color2);
+ m_tooltips[narrow_to_wide(name)] = TooltipSpec(unescape_string(parts[1]),
+ tmp_color1, tmp_color2);
return;
}
}