summaryrefslogtreecommitdiff
path: root/src/hud.cpp
diff options
context:
space:
mode:
authorEkdohibs <nathanael.courant@laposte.net>2016-04-04 18:31:00 +0200
committerCraig Robbins <kde.psych@gmail.com>2016-04-24 03:54:11 +1000
commit48939df9a5ef1ff20f4f9717d1341b51a50dff14 (patch)
tree7325a70d4dbe445d4e3726f0aea402f3181906b4 /src/hud.cpp
parent21079cc8ebae0bf694c1903c07bf3e1517feab99 (diff)
downloadminetest-48939df9a5ef1ff20f4f9717d1341b51a50dff14.tar.gz
minetest-48939df9a5ef1ff20f4f9717d1341b51a50dff14.tar.bz2
minetest-48939df9a5ef1ff20f4f9717d1341b51a50dff14.zip
Escape more strings: formspecs, item descriptions, infotexts...
Also, change the escape character to the more standard \x1b Thus, it can be used in the future for translation or colored text, for example.
Diffstat (limited to 'src/hud.cpp')
-rw-r--r--src/hud.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/hud.cpp b/src/hud.cpp
index 502865caa..19feaef7b 100644
--- a/src/hud.cpp
+++ b/src/hud.cpp
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "hud.h"
#include "settings.h"
#include "util/numeric.h"
+#include "util/string.h"
#include "log.h"
#include "gamedef.h"
#include "itemdef.h"
@@ -319,7 +320,7 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
(e->number >> 8) & 0xFF,
(e->number >> 0) & 0xFF);
core::rect<s32> size(0, 0, e->scale.X, text_height * e->scale.Y);
- std::wstring text = utf8_to_wide(e->text);
+ std::wstring text = unescape_enriched(utf8_to_wide(e->text));
core::dimension2d<u32> textsize = font->getDimension(text.c_str());
v2s32 offset((e->align.X - 1.0) * (textsize.Width / 2),
(e->align.Y - 1.0) * (textsize.Height / 2));
@@ -355,11 +356,11 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
(e->number >> 8) & 0xFF,
(e->number >> 0) & 0xFF);
core::rect<s32> size(0, 0, 200, 2 * text_height);
- std::wstring text = utf8_to_wide(e->name);
+ std::wstring text = unescape_enriched(utf8_to_wide(e->name));
font->draw(text.c_str(), size + pos, color);
std::ostringstream os;
os << distance << e->text;
- text = utf8_to_wide(os.str());
+ text = unescape_enriched(utf8_to_wide(os.str()));
pos.Y += text_height;
font->draw(text.c_str(), size + pos, color);
break; }