Formspec: Fallback to 'label' in readonly textarea[]

Guarantees backwards compatibility for this formspec element change
master
SmallJoker 2017-10-13 23:05:52 +02:00
parent 9a41a3d0f1
commit 6b23cabe51
1 changed files with 7 additions and 4 deletions

View File

@ -1120,17 +1120,20 @@ void GUIFormSpecMenu::parseTextArea(parserData* data, std::vector<std::string>&
if (is_editable) if (is_editable)
spec.send = true; spec.send = true;
gui::IGUIEditBox *e; gui::IGUIEditBox *e = nullptr;
const wchar_t *text = spec.fdefault.empty() ?
wlabel.c_str() : spec.fdefault.c_str();
#if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9 #if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
if (g_settings->getBool("freetype")) { if (g_settings->getBool("freetype")) {
e = (gui::IGUIEditBox *) new gui::intlGUIEditBox(spec.fdefault.c_str(), e = (gui::IGUIEditBox *) new gui::intlGUIEditBox(text,
true, Environment, this, spec.fid, rect, is_editable, true); true, Environment, this, spec.fid, rect, is_editable, true);
e->drop(); e->drop();
} else { } else {
#else #else
{ {
#endif #endif
e = new GUIEditBoxWithScrollBar(spec.fdefault.c_str(), true, e = new GUIEditBoxWithScrollBar(text, true,
Environment, this, spec.fid, rect, is_editable, true); Environment, this, spec.fid, rect, is_editable, true);
} }