Skip to content

Commit 140245a

Browse files
est31nerzhul
authored andcommittedMar 11, 2015
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.
1 parent 29e46d6 commit 140245a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

Diff for: ‎src/guiFormSpecMenu.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
14321432
video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
14331433

14341434
m_tooltips[narrow_to_wide(name)] =
1435-
TooltipSpec (item.getDefinition(idef).description,
1435+
TooltipSpec(item.getDefinition(idef).description,
14361436
m_default_tooltip_bgcolor,
14371437
m_default_tooltip_color);
14381438

@@ -1550,13 +1550,15 @@ void GUIFormSpecMenu::parseTooltip(parserData* data, std::string element)
15501550
std::vector<std::string> parts = split(element,';');
15511551
if (parts.size() == 2) {
15521552
std::string name = parts[0];
1553-
m_tooltips[narrow_to_wide(name)] = TooltipSpec (parts[1], m_default_tooltip_bgcolor, m_default_tooltip_color);
1553+
m_tooltips[narrow_to_wide(name)] = TooltipSpec(unescape_string(parts[1]),
1554+
m_default_tooltip_bgcolor, m_default_tooltip_color);
15541555
return;
15551556
} else if (parts.size() == 4) {
15561557
std::string name = parts[0];
15571558
video::SColor tmp_color1, tmp_color2;
15581559
if ( parseColorString(parts[2], tmp_color1, false) && parseColorString(parts[3], tmp_color2, false) ) {
1559-
m_tooltips[narrow_to_wide(name)] = TooltipSpec (parts[1], tmp_color1, tmp_color2);
1560+
m_tooltips[narrow_to_wide(name)] = TooltipSpec(unescape_string(parts[1]),
1561+
tmp_color1, tmp_color2);
15601562
return;
15611563
}
15621564
}

0 commit comments

Comments
 (0)
Please sign in to comment.