mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
fix memory leaks introduced by invalid gettext usage
This commit is contained in:
parent
cd27c8ef5d
commit
98182f6097
@ -120,11 +120,12 @@ GUIConfigureWorld::GUIConfigureWorld(gui::IGUIEnvironment* env,
|
||||
}
|
||||
if(!m_new_mod_names.empty())
|
||||
{
|
||||
wchar_t* text = wgettext("Warning: Some mods are not configured yet.\n"
|
||||
"They will be enabled by default when you save the configuration. ");
|
||||
GUIMessageMenu *menu =
|
||||
new GUIMessageMenu(Environment, Parent, -1, m_menumgr,
|
||||
wgettext("Warning: Some mods are not configured yet.\n"
|
||||
"They will be enabled by default when you save the configuration. "));
|
||||
new GUIMessageMenu(Environment, Parent, -1, m_menumgr, text);
|
||||
menu->drop();
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
|
||||
@ -139,10 +140,11 @@ GUIConfigureWorld::GUIConfigureWorld(gui::IGUIEnvironment* env,
|
||||
}
|
||||
if(!missing_mods.empty())
|
||||
{
|
||||
wchar_t* text = wgettext("Warning: Some configured mods are missing.\n"
|
||||
"Their setting will be removed when you save the configuration. ");
|
||||
GUIMessageMenu *menu =
|
||||
new GUIMessageMenu(Environment, Parent, -1, m_menumgr,
|
||||
wgettext("Warning: Some configured mods are missing.\n"
|
||||
"Their setting will be removed when you save the configuration. "));
|
||||
new GUIMessageMenu(Environment, Parent, -1, m_menumgr, text);
|
||||
delete[] text;
|
||||
for(std::set<std::string>::iterator it = missing_mods.begin();
|
||||
it != missing_mods.end(); ++it)
|
||||
m_settings.remove("load_mod_"+(*it));
|
||||
@ -203,30 +205,36 @@ void GUIConfigureWorld::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 200, 20);
|
||||
rect += v2s32(0, 25) + topleft;
|
||||
wchar_t* text = wgettext("enabled");
|
||||
m_enabled_checkbox =
|
||||
Environment->addCheckBox(false, rect, this, GUI_ID_ENABLED_CHECKBOX,
|
||||
wgettext("enabled"));
|
||||
text);
|
||||
delete[] text;
|
||||
m_enabled_checkbox->setVisible(false);
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 85, 30);
|
||||
rect = rect + v2s32(0, 25) + topleft;
|
||||
wchar_t* text = wgettext("Enable All");
|
||||
m_enableall = Environment->addButton(rect, this, GUI_ID_ENABLEALL,
|
||||
wgettext("Enable All"));
|
||||
text);
|
||||
delete[] text;
|
||||
m_enableall->setVisible(false);
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 85, 30);
|
||||
rect = rect + v2s32(115, 25) + topleft;
|
||||
m_disableall = Environment->addButton(rect, this, GUI_ID_DISABLEALL,
|
||||
wgettext("Disable All"));
|
||||
wchar_t* text = wgettext("Disable All");
|
||||
m_disableall = Environment->addButton(rect, this, GUI_ID_DISABLEALL, text );
|
||||
delete[] text;
|
||||
m_disableall->setVisible(false);
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 200, 20);
|
||||
rect += v2s32(0, 60) + topleft;
|
||||
Environment->addStaticText(wgettext("depends on:"),
|
||||
rect, false, false, this, -1);
|
||||
wchar_t* text = wgettext("depends on:");
|
||||
Environment->addStaticText(text, rect, false, false, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 200, 85);
|
||||
@ -237,8 +245,9 @@ void GUIConfigureWorld::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 200, 20);
|
||||
rect += v2s32(0, 175) + topleft;
|
||||
Environment->addStaticText(wgettext("is required by:"),
|
||||
rect, false, false, this, -1);
|
||||
wchar_t* text = wgettext("is required by:");
|
||||
Environment->addStaticText( text, rect, false, false, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 200, 85);
|
||||
@ -258,14 +267,16 @@ void GUIConfigureWorld::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 120, 30);
|
||||
rect = rect + v2s32(330, 270) - topleft;
|
||||
Environment->addButton(rect, this, GUI_ID_CANCEL,
|
||||
wgettext("Cancel"));
|
||||
wchar_t* text = wgettext("Cancel");
|
||||
Environment->addButton(rect, this, GUI_ID_CANCEL, text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 120, 30);
|
||||
rect = rect + v2s32(460, 270) - topleft;
|
||||
Environment->addButton(rect, this, GUI_ID_SAVE,
|
||||
wgettext("Save"));
|
||||
wchar_t* text = wgettext("Save");
|
||||
Environment->addButton(rect, this, GUI_ID_SAVE, text);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
|
||||
@ -389,17 +400,21 @@ bool GUIConfigureWorld::OnEvent(const SEvent& event)
|
||||
// bug in the text-size calculation. if the trailing
|
||||
// spaces are removed from the message text, the
|
||||
// message gets wrapped and parts of it are cut off:
|
||||
wchar_t* text = wgettext("Configuration saved. ");
|
||||
GUIMessageMenu *menu =
|
||||
new GUIMessageMenu(Environment, Parent, -1, m_menumgr,
|
||||
wgettext("Configuration saved. "));
|
||||
text );
|
||||
delete[] text;
|
||||
menu->drop();
|
||||
|
||||
ModConfiguration modconf(m_wspec.path);
|
||||
if(!modconf.isConsistent())
|
||||
{
|
||||
GUIMessageMenu *menu =
|
||||
wchar_t* text = wgettext("Warning: Configuration not consistent. ");
|
||||
GUIMessageMenu *menu =
|
||||
new GUIMessageMenu(Environment, Parent, -1, m_menumgr,
|
||||
wgettext("Warning: Configuration not consistent. "));
|
||||
text );
|
||||
delete[] text;
|
||||
menu->drop();
|
||||
}
|
||||
|
||||
|
@ -116,14 +116,18 @@ void GUIConfirmMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, bw, 30);
|
||||
rect = rect + v2s32(size.X/2-bw/2-(bw/2+5), size.Y/2-30/2+5 + msg_h/2);
|
||||
wchar_t* text = wgettext("Yes");
|
||||
Environment->addButton(rect, this, GUI_ID_YES,
|
||||
wgettext("Yes"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, bw, 30);
|
||||
rect = rect + v2s32(size.X/2-bw/2+(bw/2+5), size.Y/2-30/2+5 + msg_h/2);
|
||||
wchar_t* text = wgettext("No");
|
||||
Environment->addButton(rect, this, GUI_ID_NO,
|
||||
wgettext("No"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
}
|
||||
|
@ -113,8 +113,9 @@ void GUICreateWorld::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 100, 20);
|
||||
rect += v2s32(0, 5) + topleft;
|
||||
Environment->addStaticText(wgettext("World name"),
|
||||
rect, false, true, this, -1);
|
||||
wchar_t* text = wgettext("World name");
|
||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 300, 30);
|
||||
@ -132,8 +133,9 @@ void GUICreateWorld::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 100, 20);
|
||||
rect += v2s32(0, 40+5) + topleft;
|
||||
Environment->addStaticText(wgettext("Game"),
|
||||
rect, false, true, this, -1);
|
||||
wchar_t* text = wgettext("Game");
|
||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 300, 80);
|
||||
@ -155,14 +157,18 @@ void GUICreateWorld::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 120, 30);
|
||||
rect = rect + v2s32(170, 140) + topleft;
|
||||
wchar_t* text = wgettext("Create");
|
||||
Environment->addButton(rect, this, GUI_ID_CREATE,
|
||||
wgettext("Create"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 120, 30);
|
||||
rect = rect + v2s32(300, 140) + topleft;
|
||||
wchar_t* text = wgettext("Cancel");
|
||||
Environment->addButton(rect, this, GUI_ID_CANCEL,
|
||||
wgettext("Cancel"));
|
||||
text);
|
||||
delete [] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
}
|
||||
|
@ -93,15 +93,19 @@ void GUIDeathScreen::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 400, 50);
|
||||
rect = rect + v2s32(size.X/2-400/2, size.Y/2-50/2-25);
|
||||
Environment->addStaticText(wgettext("You died."), rect, false,
|
||||
wchar_t* text = wgettext("You died.");
|
||||
Environment->addStaticText(text, rect, false,
|
||||
true, this, 256);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, 30);
|
||||
rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25);
|
||||
wchar_t* text = wgettext("Respawn");
|
||||
gui::IGUIElement *e =
|
||||
Environment->addButton(rect, this, 257,
|
||||
wgettext("Respawn"));
|
||||
text);
|
||||
delete[] text;
|
||||
Environment->setFocus(e);
|
||||
}
|
||||
changeCtype("C");
|
||||
|
@ -581,6 +581,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
size.Y-rect.getHeight()-5);
|
||||
const wchar_t *text = wgettext("Left click: Move all items, Right click: Move single item");
|
||||
Environment->addStaticText(text, rect, false, true, this, 256);
|
||||
delete[] text;
|
||||
changeCtype("C");
|
||||
}
|
||||
// If there's fields, add a Proceed button
|
||||
@ -604,7 +605,9 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
|
||||
v2s32 size = DesiredRect.getSize();
|
||||
rect = core::rect<s32>(size.X/2-70, pos.Y, (size.X/2-70)+140, pos.Y+30);
|
||||
Environment->addButton(rect, this, 257, wgettext("Proceed"));
|
||||
wchar_t* text = wgettext("Proceed");
|
||||
Environment->addButton(rect, this, 257, text);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
}
|
||||
|
@ -75,6 +75,13 @@ GUIModalMenu(env, parent, id, menumgr)
|
||||
GUIKeyChangeMenu::~GUIKeyChangeMenu()
|
||||
{
|
||||
removeChildren();
|
||||
|
||||
for (std::vector<key_setting*>::iterator iter = key_settings.begin();
|
||||
iter != key_settings.end(); iter ++) {
|
||||
delete[] (*iter)->button_name;
|
||||
delete (*iter);
|
||||
}
|
||||
key_settings.clear();
|
||||
}
|
||||
|
||||
void GUIKeyChangeMenu::removeChildren()
|
||||
@ -111,8 +118,10 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
core::rect < s32 > rect(0, 0, 600, 40);
|
||||
rect += topleft + v2s32(25, 3);
|
||||
//gui::IGUIStaticText *t =
|
||||
Environment->addStaticText(wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)"),
|
||||
wchar_t* text = wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)");
|
||||
Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
//t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT);
|
||||
}
|
||||
|
||||
@ -132,7 +141,9 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect < s32 > rect(0, 0, 100, 30);
|
||||
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||
k->button = Environment->addButton(rect, this, k->id, wgettext(k->key.name()));
|
||||
wchar_t* text = wgettext(k->key.name());
|
||||
k->button = Environment->addButton(rect, this, k->id, text );
|
||||
delete[] text;
|
||||
}
|
||||
if(i + 1 == KMaxButtonPerColumns)
|
||||
offset = v2s32(250, 60);
|
||||
@ -147,8 +158,10 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += topleft + v2s32(option_x, option_y);
|
||||
wchar_t* text = wgettext("\"Use\" = climb down");
|
||||
Environment->addCheckBox(g_settings->getBool("aux1_descends"), rect, this,
|
||||
GUI_ID_CB_AUX1_DESCENDS, wgettext("\"Use\" = climb down"));
|
||||
GUI_ID_CB_AUX1_DESCENDS, text);
|
||||
delete[] text;
|
||||
}
|
||||
offset += v2s32(0, 25);
|
||||
}
|
||||
@ -160,8 +173,10 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += topleft + v2s32(option_x, option_y);
|
||||
wchar_t* text = wgettext("Double tap \"jump\" to toggle fly");
|
||||
Environment->addCheckBox(g_settings->getBool("doubletap_jump"), rect, this,
|
||||
GUI_ID_CB_DOUBLETAP_JUMP, wgettext("Double tap \"jump\" to toggle fly"));
|
||||
GUI_ID_CB_DOUBLETAP_JUMP, text);
|
||||
delete[] text;
|
||||
}
|
||||
offset += v2s32(0, 25);
|
||||
}
|
||||
@ -169,14 +184,18 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect < s32 > rect(0, 0, 100, 30);
|
||||
rect += topleft + v2s32(size.X - 100 - 20, size.Y - 40);
|
||||
wchar_t* text = wgettext("Save");
|
||||
Environment->addButton(rect, this, GUI_ID_BACK_BUTTON,
|
||||
wgettext("Save"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect < s32 > rect(0, 0, 100, 30);
|
||||
rect += topleft + v2s32(size.X - 100 - 20 - 100 - 20, size.Y - 40);
|
||||
wchar_t* text = wgettext("Cancel");
|
||||
Environment->addButton(rect, this, GUI_ID_ABORT_BUTTON,
|
||||
wgettext("Cancel"));
|
||||
text );
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
|
||||
@ -230,7 +249,9 @@ bool GUIKeyChangeMenu::resetMenu()
|
||||
key_setting *k = key_settings.at(i);
|
||||
if(k->id == activeKey)
|
||||
{
|
||||
k->button->setText(wgettext(k->key.name()));
|
||||
wchar_t* text = wgettext(k->key.name());
|
||||
k->button->setText(text);
|
||||
delete[] text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -266,8 +287,10 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||
{
|
||||
core::rect < s32 > rect(0, 0, 600, 40);
|
||||
rect += v2s32(0, 0) + v2s32(25, 30);
|
||||
this->key_used_text = Environment->addStaticText(wgettext("Key already in use"),
|
||||
wchar_t* text = wgettext("Key already in use");
|
||||
this->key_used_text = Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
//infostream << "Key already in use" << std::endl;
|
||||
}
|
||||
|
||||
@ -284,7 +307,9 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||
}
|
||||
assert(k);
|
||||
k->key = kp;
|
||||
k->button->setText(wgettext(k->key.name()));
|
||||
wchar_t* text = wgettext(k->key.name());
|
||||
k->button->setText(text);
|
||||
delete[] text;
|
||||
|
||||
this->key_used.push_back(kp);
|
||||
|
||||
@ -344,7 +369,9 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||
resetMenu();
|
||||
shift_down = false;
|
||||
activeKey = event.GUIEvent.Caller->getID();
|
||||
k->button->setText(wgettext("press key"));
|
||||
wchar_t* text = wgettext("press key");
|
||||
k->button->setText(text);
|
||||
delete[] text;
|
||||
this->key_used.erase(std::remove(this->key_used.begin(),
|
||||
this->key_used.end(), k->key), this->key_used.end());
|
||||
break;
|
||||
@ -357,11 +384,12 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||
return Parent ? Parent->OnEvent(event) : false;
|
||||
}
|
||||
|
||||
void GUIKeyChangeMenu::add_key(int id, std::string button_name, std::string setting_name)
|
||||
void GUIKeyChangeMenu::add_key(int id, wchar_t* button_name, std::string setting_name)
|
||||
{
|
||||
key_setting *k = new key_setting;
|
||||
k->id = id;
|
||||
k->button_name = wgettext(button_name.c_str());
|
||||
|
||||
k->button_name = button_name;
|
||||
k->setting_name = setting_name;
|
||||
k->key = getKeySetting(k->setting_name.c_str());
|
||||
key_settings.push_back(k);
|
||||
@ -369,21 +397,21 @@ void GUIKeyChangeMenu::add_key(int id, std::string button_name, std::string sett
|
||||
|
||||
void GUIKeyChangeMenu::init_keys()
|
||||
{
|
||||
this->add_key(GUI_ID_KEY_FORWARD_BUTTON, gettext("Forward"), "keymap_forward");
|
||||
this->add_key(GUI_ID_KEY_BACKWARD_BUTTON, gettext("Backward"), "keymap_backward");
|
||||
this->add_key(GUI_ID_KEY_LEFT_BUTTON, gettext("Left"), "keymap_left");
|
||||
this->add_key(GUI_ID_KEY_RIGHT_BUTTON, gettext("Right"), "keymap_right");
|
||||
this->add_key(GUI_ID_KEY_USE_BUTTON, gettext("Use"), "keymap_special1");
|
||||
this->add_key(GUI_ID_KEY_JUMP_BUTTON, gettext("Jump"), "keymap_jump");
|
||||
this->add_key(GUI_ID_KEY_SNEAK_BUTTON, gettext("Sneak"), "keymap_sneak");
|
||||
this->add_key(GUI_ID_KEY_DROP_BUTTON, gettext("Drop"), "keymap_drop");
|
||||
this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, gettext("Inventory"), "keymap_inventory");
|
||||
this->add_key(GUI_ID_KEY_CHAT_BUTTON, gettext("Chat"), "keymap_chat");
|
||||
this->add_key(GUI_ID_KEY_CMD_BUTTON, gettext("Command"), "keymap_cmd");
|
||||
this->add_key(GUI_ID_KEY_CONSOLE_BUTTON, gettext("Console"), "keymap_console");
|
||||
this->add_key(GUI_ID_KEY_FLY_BUTTON, gettext("Toggle fly"), "keymap_freemove");
|
||||
this->add_key(GUI_ID_KEY_FAST_BUTTON, gettext("Toggle fast"), "keymap_fastmove");
|
||||
this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, gettext("Toggle noclip"), "keymap_noclip");
|
||||
this->add_key(GUI_ID_KEY_RANGE_BUTTON, gettext("Range select"), "keymap_rangeselect");
|
||||
this->add_key(GUI_ID_KEY_DUMP_BUTTON, gettext("Print stacks"), "keymap_print_debug_stacks");
|
||||
this->add_key(GUI_ID_KEY_FORWARD_BUTTON, wgettext("Forward"), "keymap_forward");
|
||||
this->add_key(GUI_ID_KEY_BACKWARD_BUTTON, wgettext("Backward"), "keymap_backward");
|
||||
this->add_key(GUI_ID_KEY_LEFT_BUTTON, wgettext("Left"), "keymap_left");
|
||||
this->add_key(GUI_ID_KEY_RIGHT_BUTTON, wgettext("Right"), "keymap_right");
|
||||
this->add_key(GUI_ID_KEY_USE_BUTTON, wgettext("Use"), "keymap_special1");
|
||||
this->add_key(GUI_ID_KEY_JUMP_BUTTON, wgettext("Jump"), "keymap_jump");
|
||||
this->add_key(GUI_ID_KEY_SNEAK_BUTTON, wgettext("Sneak"), "keymap_sneak");
|
||||
this->add_key(GUI_ID_KEY_DROP_BUTTON, wgettext("Drop"), "keymap_drop");
|
||||
this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, wgettext("Inventory"), "keymap_inventory");
|
||||
this->add_key(GUI_ID_KEY_CHAT_BUTTON, wgettext("Chat"), "keymap_chat");
|
||||
this->add_key(GUI_ID_KEY_CMD_BUTTON, wgettext("Command"), "keymap_cmd");
|
||||
this->add_key(GUI_ID_KEY_CONSOLE_BUTTON, wgettext("Console"), "keymap_console");
|
||||
this->add_key(GUI_ID_KEY_FLY_BUTTON, wgettext("Toggle fly"), "keymap_freemove");
|
||||
this->add_key(GUI_ID_KEY_FAST_BUTTON, wgettext("Toggle fast"), "keymap_fastmove");
|
||||
this->add_key(GUI_ID_KEY_NOCLIP_BUTTON, wgettext("Toggle noclip"), "keymap_noclip");
|
||||
this->add_key(GUI_ID_KEY_RANGE_BUTTON, wgettext("Range select"), "keymap_rangeselect");
|
||||
this->add_key(GUI_ID_KEY_DUMP_BUTTON, wgettext("Print stacks"), "keymap_print_debug_stacks");
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
|
||||
bool resetMenu();
|
||||
|
||||
void add_key(int id, std::string setting_name, std::string button_name);
|
||||
void add_key(int id, wchar_t* button_name, std::string setting_name);
|
||||
|
||||
bool shift_down;
|
||||
|
||||
|
@ -89,7 +89,9 @@ struct CreateWorldDestMainMenu : public CreateWorldDest
|
||||
std::string name_narrow = wide_to_narrow(name);
|
||||
if(!string_allowed_blacklist(name_narrow, WORLDNAME_BLACKLISTED_CHARS))
|
||||
{
|
||||
m_menu->displayMessageMenu(wgettext("Cannot create world: Name contains invalid characters"));
|
||||
wchar_t* text = wgettext("Cannot create world: Name contains invalid characters");
|
||||
m_menu->displayMessageMenu(text);
|
||||
delete[] text;
|
||||
return;
|
||||
}
|
||||
std::vector<WorldSpec> worlds = getAvailableWorlds();
|
||||
@ -98,7 +100,9 @@ struct CreateWorldDestMainMenu : public CreateWorldDest
|
||||
{
|
||||
if((*i).name == name_narrow)
|
||||
{
|
||||
m_menu->displayMessageMenu(wgettext("Cannot create world: A world by this name already exists"));
|
||||
wchar_t* text = wgettext("Cannot create world: A world by this name already exists");
|
||||
m_menu->displayMessageMenu(text);
|
||||
delete[] text;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -280,12 +284,24 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
rect += m_topleft_client + v2s32(0, -30);
|
||||
gui::IGUITabControl *e = Environment->addTabControl(
|
||||
rect, this, true, true, GUI_ID_TAB_CONTROL);
|
||||
e->addTab(wgettext("Singleplayer"));
|
||||
e->addTab(wgettext("Multiplayer"));
|
||||
e->addTab(wgettext("Advanced"));
|
||||
e->addTab(wgettext("Settings"));
|
||||
e->addTab(wgettext("Credits"));
|
||||
wchar_t* text = wgettext("Singleplayer");
|
||||
e->addTab(text);
|
||||
delete[] text;
|
||||
text = wgettext("Multiplayer");
|
||||
e->addTab(text);
|
||||
delete[] text;
|
||||
text = wgettext("Advanced");
|
||||
e->addTab(text);
|
||||
delete[] text;
|
||||
text = wgettext("Settings");
|
||||
e->addTab(text);
|
||||
delete[] text;
|
||||
text = wgettext("Credits");
|
||||
e->addTab(text);
|
||||
delete[] text;
|
||||
|
||||
e->setActiveTab(m_data->selected_tab);
|
||||
|
||||
}
|
||||
|
||||
if(m_data->selected_tab == TAB_SINGLEPLAYER)
|
||||
@ -313,9 +329,11 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, world_sel_w-4, 20);
|
||||
rect += m_topleft_client + v2s32(world_sel_x+4, world_sel_y-20);
|
||||
wchar_t* text = wgettext("Select World:");
|
||||
/*gui::IGUIStaticText *e =*/ Environment->addStaticText(
|
||||
wgettext("Select World:"),
|
||||
text,
|
||||
rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
/*e->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_CENTER);*/
|
||||
}
|
||||
{
|
||||
@ -335,23 +353,29 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, world_button_w, 30);
|
||||
rect += m_topleft_client + v2s32(world_sel_x, world_sel_y+world_sel_h+0);
|
||||
wchar_t* text = wgettext("Delete");
|
||||
Environment->addButton(rect, this, GUI_ID_DELETE_WORLD_BUTTON,
|
||||
wgettext("Delete"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
// Create world button
|
||||
{
|
||||
core::rect<s32> rect(0, 0, world_button_w, 30);
|
||||
rect += m_topleft_client + v2s32(world_sel_x+world_button_w+bs, world_sel_y+world_sel_h+0);
|
||||
wchar_t* text = wgettext("New");
|
||||
Environment->addButton(rect, this, GUI_ID_CREATE_WORLD_BUTTON,
|
||||
wgettext("New"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
// Configure world button
|
||||
{
|
||||
core::rect<s32> rect(0, 0, world_button_w, 30);
|
||||
rect += m_topleft_client + v2s32(world_sel_x+(world_button_w+bs)*2,
|
||||
world_sel_y+world_sel_h+0);
|
||||
wchar_t* text = wgettext("Configure");
|
||||
Environment->addButton(rect, this, GUI_ID_CONFIGURE_WORLD_BUTTON,
|
||||
wgettext("Configure"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
// Start game button
|
||||
{
|
||||
@ -365,8 +389,10 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
core::rect<s32> rect(0, 0, bw, 30);
|
||||
rect += m_topleft_client + v2s32(world_sel_x+world_sel_w-bw,
|
||||
world_sel_y+world_sel_h+30+bs);
|
||||
wchar_t* text = wgettext("Play");
|
||||
Environment->addButton(rect, this,
|
||||
GUI_ID_JOIN_GAME_BUTTON, wgettext("Play"));
|
||||
GUI_ID_JOIN_GAME_BUTTON, text);
|
||||
delete[] text;
|
||||
}
|
||||
// Options
|
||||
s32 option_x = 50;
|
||||
@ -376,14 +402,18 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += m_topleft_client + v2s32(option_x, option_y+20*0);
|
||||
wchar_t* text = wgettext("Creative Mode");
|
||||
Environment->addCheckBox(m_data->creative_mode, rect, this,
|
||||
GUI_ID_CREATIVE_CB, wgettext("Creative Mode"));
|
||||
GUI_ID_CREATIVE_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += m_topleft_client + v2s32(option_x, option_y+20*1);
|
||||
wchar_t* text = wgettext("Enable Damage");
|
||||
Environment->addCheckBox(m_data->enable_damage, rect, this,
|
||||
GUI_ID_DAMAGE_CB, wgettext("Enable Damage"));
|
||||
GUI_ID_DAMAGE_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
}
|
||||
@ -402,9 +432,11 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
// Nickname + password
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
wchar_t* text = wgettext("Name/Password");
|
||||
rect += m_topleft_client + v2s32(m_size_client.X-60-100, 10+6);
|
||||
Environment->addStaticText(wgettext("Name/Password"),
|
||||
Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
delete [] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
{
|
||||
@ -467,8 +499,10 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += m_topleft_client + v2s32(50, m_size_client.Y-50-15+6);
|
||||
Environment->addStaticText(wgettext("Address/Port"),
|
||||
wchar_t* text = wgettext("Address/Port");
|
||||
Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
delete [] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
{
|
||||
@ -493,13 +527,17 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
core::rect<s32> rect(0, 0, 260, 30);
|
||||
rect += m_topleft_client + v2s32(50,
|
||||
180);
|
||||
wchar_t* text = wgettext("Show Public");
|
||||
gui::IGUIButton *e = Environment->addButton(rect, this, GUI_ID_SERVERLIST_TOGGLE,
|
||||
wgettext("Show Public"));
|
||||
text);
|
||||
delete[] text;
|
||||
e->setIsPushButton(true);
|
||||
if (m_data->selected_serverlist == SERVERLIST_PUBLIC)
|
||||
{
|
||||
e->setText(wgettext("Show Favorites"));
|
||||
wchar_t* text = wgettext("Show Favorites");
|
||||
e->setText(text);
|
||||
e->setPressed();
|
||||
delete[] text;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -507,18 +545,23 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 120, 30);
|
||||
rect += m_topleft_client + v2s32(50+260+10, 180);
|
||||
wchar_t* text = wgettext("Delete");
|
||||
gui::IGUIButton *e = Environment->addButton(rect, this, GUI_ID_SERVERLIST_DELETE,
|
||||
wgettext("Delete"));
|
||||
text);
|
||||
if (m_data->selected_serverlist == SERVERLIST_PUBLIC) // Hidden when on public list
|
||||
e->setVisible(false);
|
||||
|
||||
delete [] text;
|
||||
}
|
||||
// Start game button
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 120, 30);
|
||||
rect += m_topleft_client + v2s32(m_size_client.X-130-30,
|
||||
m_size_client.Y-25-15);
|
||||
wchar_t* text = wgettext("Connect");
|
||||
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON,
|
||||
wgettext("Connect"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
}
|
||||
@ -538,8 +581,10 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += m_topleft_client + v2s32(35+30, 35+6);
|
||||
Environment->addStaticText(wgettext("Name/Password"),
|
||||
wchar_t* text = wgettext("Name/Password");
|
||||
Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
delete [] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
{
|
||||
@ -565,8 +610,10 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += m_topleft_client + v2s32(35+30, 75+6);
|
||||
Environment->addStaticText(wgettext("Address/Port"),
|
||||
wchar_t* text = wgettext("Address/Port");
|
||||
Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
{
|
||||
@ -588,16 +635,20 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 400, 20);
|
||||
rect += m_topleft_client + v2s32(160+30, 75+35);
|
||||
Environment->addStaticText(wgettext("Leave address blank to start a local server."),
|
||||
wchar_t* text = wgettext("Leave address blank to start a local server.");
|
||||
Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
// Start game button
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 180, 30);
|
||||
rect += m_topleft_client + v2s32(m_size_client.X-180-30,
|
||||
m_size_client.Y-30-20);
|
||||
wchar_t* text = wgettext("Start Game / Connect");
|
||||
Environment->addButton(rect, this, GUI_ID_JOIN_GAME_BUTTON,
|
||||
wgettext("Start Game / Connect"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
/*
|
||||
Server section
|
||||
@ -615,36 +666,46 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 250, 30);
|
||||
rect += m_topleft_server + v2s32(30+20+250+20, 20);
|
||||
wchar_t* text = wgettext("Creative Mode");
|
||||
Environment->addCheckBox(m_data->creative_mode, rect, this, GUI_ID_CREATIVE_CB,
|
||||
wgettext("Creative Mode"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 250, 30);
|
||||
rect += m_topleft_server + v2s32(30+20+250+20, 40);
|
||||
wchar_t* text = wgettext("Enable Damage");
|
||||
Environment->addCheckBox(m_data->enable_damage, rect, this, GUI_ID_DAMAGE_CB,
|
||||
wgettext("Enable Damage"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
#if USE_CURL
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 250, 30);
|
||||
rect += m_topleft_server + v2s32(30+20+250+20, 60);
|
||||
wchar_t* text = wgettext("Public");
|
||||
Environment->addCheckBox(m_data->enable_public, rect, this, GUI_ID_PUBLIC_CB,
|
||||
wgettext("Public"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
#endif
|
||||
// Delete world button
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 130, 30);
|
||||
rect += m_topleft_server + v2s32(30+20+250+20, 90);
|
||||
wchar_t* text = wgettext("Delete world");
|
||||
Environment->addButton(rect, this, GUI_ID_DELETE_WORLD_BUTTON,
|
||||
wgettext("Delete world"));
|
||||
text );
|
||||
delete[] text;
|
||||
}
|
||||
// Create world button
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 130, 30);
|
||||
rect += m_topleft_server + v2s32(30+20+250+20+140, 90);
|
||||
wchar_t* text = wgettext("Create world");
|
||||
Environment->addButton(rect, this, GUI_ID_CREATE_WORLD_BUTTON,
|
||||
wgettext("Create world"));
|
||||
text );
|
||||
delete[] text;
|
||||
}
|
||||
// World selection listbox
|
||||
{
|
||||
@ -677,26 +738,34 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += m_topleft_client + v2s32(option_x, option_y);
|
||||
wchar_t* text = wgettext("Fancy trees");
|
||||
Environment->addCheckBox(m_data->fancy_trees, rect, this,
|
||||
GUI_ID_FANCYTREE_CB, wgettext("Fancy trees"));
|
||||
GUI_ID_FANCYTREE_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += m_topleft_client + v2s32(option_x, option_y+20);
|
||||
wchar_t* text = wgettext("Smooth Lighting");
|
||||
Environment->addCheckBox(m_data->smooth_lighting, rect, this,
|
||||
GUI_ID_SMOOTH_LIGHTING_CB, wgettext("Smooth Lighting"));
|
||||
GUI_ID_SMOOTH_LIGHTING_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += m_topleft_client + v2s32(option_x, option_y+20*2);
|
||||
wchar_t* text = wgettext("3D Clouds");
|
||||
Environment->addCheckBox(m_data->clouds_3d, rect, this,
|
||||
GUI_ID_3D_CLOUDS_CB, wgettext("3D Clouds"));
|
||||
GUI_ID_3D_CLOUDS_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += m_topleft_client + v2s32(option_x, option_y+20*3);
|
||||
wchar_t* text = wgettext("Opaque water");
|
||||
Environment->addCheckBox(m_data->opaque_water, rect, this,
|
||||
GUI_ID_OPAQUE_WATER_CB, wgettext("Opaque water"));
|
||||
GUI_ID_OPAQUE_WATER_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
|
||||
@ -705,58 +774,74 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w+20, 30);
|
||||
rect += m_topleft_client + v2s32(option_x+175, option_y);
|
||||
wchar_t* text = wgettext("Mip-Mapping");
|
||||
Environment->addCheckBox(m_data->mip_map, rect, this,
|
||||
GUI_ID_MIPMAP_CB, wgettext("Mip-Mapping"));
|
||||
GUI_ID_MIPMAP_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w+20, 30);
|
||||
rect += m_topleft_client + v2s32(option_x+175, option_y+20);
|
||||
wchar_t* text = wgettext("Anisotropic Filtering");
|
||||
Environment->addCheckBox(m_data->anisotropic_filter, rect, this,
|
||||
GUI_ID_ANISOTROPIC_CB, wgettext("Anisotropic Filtering"));
|
||||
GUI_ID_ANISOTROPIC_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w+20, 30);
|
||||
rect += m_topleft_client + v2s32(option_x+175, option_y+20*2);
|
||||
wchar_t* text = wgettext("Bi-Linear Filtering");
|
||||
Environment->addCheckBox(m_data->bilinear_filter, rect, this,
|
||||
GUI_ID_BILINEAR_CB, wgettext("Bi-Linear Filtering"));
|
||||
GUI_ID_BILINEAR_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w+20, 30);
|
||||
rect += m_topleft_client + v2s32(option_x+175, option_y+20*3);
|
||||
wchar_t* text = wgettext("Tri-Linear Filtering");
|
||||
Environment->addCheckBox(m_data->trilinear_filter, rect, this,
|
||||
GUI_ID_TRILINEAR_CB, wgettext("Tri-Linear Filtering"));
|
||||
GUI_ID_TRILINEAR_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
// shader/on demand image loading/particles settings
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w+20, 30);
|
||||
rect += m_topleft_client + v2s32(option_x+175*2, option_y);
|
||||
wchar_t* text = wgettext("Shaders");
|
||||
Environment->addCheckBox(m_data->enable_shaders, rect, this,
|
||||
GUI_ID_SHADERS_CB, wgettext("Shaders"));
|
||||
GUI_ID_SHADERS_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w+20+20, 30);
|
||||
rect += m_topleft_client + v2s32(option_x+175*2, option_y+20);
|
||||
wchar_t* text = wgettext("Preload item visuals");
|
||||
Environment->addCheckBox(m_data->preload_item_visuals, rect, this,
|
||||
GUI_ID_PRELOAD_ITEM_VISUALS_CB, wgettext("Preload item visuals"));
|
||||
GUI_ID_PRELOAD_ITEM_VISUALS_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w+20+20, 30);
|
||||
rect += m_topleft_client + v2s32(option_x+175*2, option_y+20*2);
|
||||
wchar_t* text = wgettext("Enable Particles");
|
||||
Environment->addCheckBox(m_data->enable_particles, rect, this,
|
||||
GUI_ID_ENABLE_PARTICLES_CB, wgettext("Enable Particles"));
|
||||
GUI_ID_ENABLE_PARTICLES_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w+20+20, 30);
|
||||
rect += m_topleft_client + v2s32(option_x+175*2, option_y+20*3);
|
||||
wchar_t* text = wgettext("Finite liquid");
|
||||
Environment->addCheckBox(m_data->liquid_finite, rect, this,
|
||||
GUI_ID_LIQUID_FINITE_CB, wgettext("Finite liquid"));
|
||||
GUI_ID_LIQUID_FINITE_CB, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
// Key change button
|
||||
@ -765,8 +850,10 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
||||
/*rect += m_topleft_client + v2s32(m_size_client.X-120-30,
|
||||
m_size_client.Y-30-20);*/
|
||||
rect += m_topleft_client + v2s32(option_x, option_y+120);
|
||||
wchar_t* text = wgettext("Change keys");
|
||||
Environment->addButton(rect, this,
|
||||
GUI_ID_CHANGE_KEYS_BUTTON, wgettext("Change keys"));
|
||||
GUI_ID_CHANGE_KEYS_BUTTON, text);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
}
|
||||
@ -1080,9 +1167,11 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||
readInput(&cur);
|
||||
if (getTab() == TAB_MULTIPLAYER && cur.address == L"")
|
||||
{
|
||||
wchar_t* text = wgettext("Address required.");
|
||||
(new GUIMessageMenu(env, parent, -1, menumgr,
|
||||
wgettext("Address required."))
|
||||
text)
|
||||
)->drop();
|
||||
delete[] text;
|
||||
return true;
|
||||
}
|
||||
acceptInput();
|
||||
@ -1098,9 +1187,11 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||
MainMenuData cur;
|
||||
readInput(&cur);
|
||||
if(cur.selected_world == -1){
|
||||
wchar_t* text = wgettext("Cannot delete world: Nothing selected");
|
||||
(new GUIMessageMenu(env, parent, -1, menumgr,
|
||||
wgettext("Cannot delete world: Nothing selected"))
|
||||
text)
|
||||
)->drop();
|
||||
delete[] text;
|
||||
} else {
|
||||
WorldSpec spec = m_data->worlds[cur.selected_world];
|
||||
// Get files and directories involved
|
||||
@ -1110,12 +1201,16 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||
// Launch confirmation dialog
|
||||
ConfirmDestDeleteWorld *dest = new
|
||||
ConfirmDestDeleteWorld(spec, this, paths);
|
||||
std::wstring text = wgettext("Delete world");
|
||||
wchar_t* text1 = wgettext("Delete world");
|
||||
wchar_t* text2 = wgettext("Files to be deleted");
|
||||
std::wstring text = text1;
|
||||
text += L" \"";
|
||||
text += narrow_to_wide(spec.name);
|
||||
text += L"\"?\n\n";
|
||||
text += wgettext("Files to be deleted");
|
||||
text += text2;
|
||||
text += L":\n";
|
||||
delete[] text1;
|
||||
delete[] text2;
|
||||
for(u32 i=0; i<paths.size(); i++){
|
||||
if(i == 3){ text += L"..."; break; }
|
||||
text += narrow_to_wide(paths[i]) + L"\n";
|
||||
@ -1128,10 +1223,12 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||
case GUI_ID_CREATE_WORLD_BUTTON: {
|
||||
std::vector<SubgameSpec> games = getAvailableGames();
|
||||
if(games.size() == 0){
|
||||
wchar_t* text = wgettext("Cannot create world: No games found");
|
||||
GUIMessageMenu *menu = new GUIMessageMenu(env, parent,
|
||||
-1, menumgr,
|
||||
wgettext("Cannot create world: No games found"));
|
||||
text);
|
||||
menu->drop();
|
||||
delete[] text;
|
||||
} else {
|
||||
CreateWorldDest *dest = new CreateWorldDestMainMenu(this);
|
||||
GUICreateWorld *menu = new GUICreateWorld(env, parent, -1,
|
||||
@ -1145,9 +1242,11 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||
readInput(&cur);
|
||||
if(cur.selected_world == -1)
|
||||
{
|
||||
wchar_t* text = wgettext("Cannot configure world: Nothing selected");
|
||||
(new GUIMessageMenu(env, parent, -1, menumgr,
|
||||
wgettext("Cannot configure world: Nothing selected"))
|
||||
text)
|
||||
)->drop();
|
||||
delete[] text;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1180,8 +1279,12 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||
if (m_data->selected_serverlist == SERVERLIST_PUBLIC) // switch to favorite list
|
||||
{
|
||||
m_data->servers = ServerList::getLocal();
|
||||
togglebutton->setText(wgettext("Show Public"));
|
||||
title->setText(wgettext("Favorites:"));
|
||||
wchar_t* text1 = wgettext("Show Public");
|
||||
wchar_t* text2 = wgettext("Favorites:");
|
||||
togglebutton->setText(text1);
|
||||
title->setText(text2);
|
||||
delete[] text1;
|
||||
delete[] text2;
|
||||
deletebutton->setVisible(true);
|
||||
updateGuiServerList();
|
||||
serverlist->setSelected(0);
|
||||
@ -1190,8 +1293,12 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
||||
else // switch to online list
|
||||
{
|
||||
m_data->servers = ServerList::getOnline();
|
||||
togglebutton->setText(wgettext("Show Favorites"));
|
||||
title->setText(wgettext("Public Server List:"));
|
||||
wchar_t* text1 = wgettext("Show Favorites");
|
||||
wchar_t* text2 = wgettext("Public Server List:");
|
||||
togglebutton->setText(text1);
|
||||
title->setText(text2);
|
||||
delete[] text1;
|
||||
delete[] text2;
|
||||
deletebutton->setVisible(false);
|
||||
updateGuiServerList();
|
||||
serverlist->setSelected(0);
|
||||
@ -1261,8 +1368,10 @@ void GUIMainMenu::deleteWorld(const std::vector<std::string> &paths)
|
||||
// Delete files
|
||||
bool did = fs::DeletePaths(paths);
|
||||
if(!did){
|
||||
wchar_t* text = wgettext("Failed to delete all world files");
|
||||
GUIMessageMenu *menu = new GUIMessageMenu(env, parent,
|
||||
-1, menumgr, wgettext("Failed to delete all world files"));
|
||||
-1, menumgr, text);
|
||||
delete[] text;
|
||||
menu->drop();
|
||||
}
|
||||
// Quit menu to refresh it
|
||||
|
@ -104,10 +104,12 @@ void GUIMessageMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, bw, 30);
|
||||
rect = rect + v2s32(size.X/2-bw/2, size.Y/2-30/2+5 + msg_h/2);
|
||||
wchar_t* text = wgettext("Proceed");
|
||||
gui::IGUIElement *e =
|
||||
Environment->addButton(rect, this, 257,
|
||||
wgettext("Proceed"));
|
||||
text);
|
||||
Environment->setFocus(e);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
}
|
||||
|
@ -105,8 +105,9 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += topleft_client + v2s32(35, ypos+6);
|
||||
Environment->addStaticText(wgettext("Old Password"),
|
||||
rect, false, true, this, -1);
|
||||
wchar_t* text = wgettext("Old Password");
|
||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
{
|
||||
@ -122,8 +123,9 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += topleft_client + v2s32(35, ypos+6);
|
||||
Environment->addStaticText(wgettext("New Password"),
|
||||
rect, false, true, this, -1);
|
||||
wchar_t* text = wgettext("New Password");
|
||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
{
|
||||
@ -138,8 +140,9 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += topleft_client + v2s32(35, ypos+6);
|
||||
Environment->addStaticText(wgettext("Confirm Password"),
|
||||
rect, false, true, this, -1);
|
||||
wchar_t* text = wgettext("Confirm Password");
|
||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
{
|
||||
@ -155,18 +158,22 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, 30);
|
||||
rect = rect + v2s32(size.X/2-140/2, ypos);
|
||||
Environment->addButton(rect, this, ID_change, wgettext("Change"));
|
||||
wchar_t* text = wgettext("Change");
|
||||
Environment->addButton(rect, this, ID_change, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
ypos += 50;
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 300, 20);
|
||||
rect += topleft_client + v2s32(35, ypos);
|
||||
wchar_t* text = wgettext("Passwords do not match!");
|
||||
IGUIElement *e =
|
||||
Environment->addStaticText(
|
||||
wgettext("Passwords do not match!"),
|
||||
text,
|
||||
rect, false, true, this, ID_message);
|
||||
e->setVisible(false);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
|
||||
|
@ -119,8 +119,10 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, btn_height);
|
||||
rect = rect + v2s32(size.X/2-140/2, btn_y);
|
||||
wchar_t* text = wgettext("Continue");
|
||||
Environment->addButton(rect, this, 256,
|
||||
wgettext("Continue"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
btn_y += btn_height + btn_gap;
|
||||
if(!m_simple_singleplayer_mode)
|
||||
@ -128,48 +130,58 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, btn_height);
|
||||
rect = rect + v2s32(size.X/2-140/2, btn_y);
|
||||
wchar_t* text = wgettext("Change Password");
|
||||
Environment->addButton(rect, this, 261,
|
||||
wgettext("Change Password"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
btn_y += btn_height + btn_gap;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, btn_height);
|
||||
rect = rect + v2s32(size.X/2-140/2, btn_y);
|
||||
wchar_t* text = wgettext("Sound Volume");
|
||||
Environment->addButton(rect, this, 262,
|
||||
wgettext("Sound Volume"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
btn_y += btn_height + btn_gap;
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, btn_height);
|
||||
rect = rect + v2s32(size.X/2-140/2, btn_y);
|
||||
wchar_t* text = wgettext("Exit to Menu");
|
||||
Environment->addButton(rect, this, 260,
|
||||
wgettext("Exit to Menu"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
btn_y += btn_height + btn_gap;
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, btn_height);
|
||||
rect = rect + v2s32(size.X/2-140/2, btn_y);
|
||||
wchar_t* text = wgettext("Exit to OS");
|
||||
Environment->addButton(rect, this, 257,
|
||||
wgettext("Exit to OS"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 180, 240);
|
||||
rect = rect + v2s32(size.X/2 + 90, size.Y/2-rect.getHeight()/2);
|
||||
Environment->addStaticText(chartowchar_t(gettext(
|
||||
"Default Controls:\n"
|
||||
"- WASD: Walk\n"
|
||||
"- Mouse left: dig/hit\n"
|
||||
"- Mouse right: place/use\n"
|
||||
"- Mouse wheel: select item\n"
|
||||
"- 0...9: select item\n"
|
||||
"- Shift: sneak\n"
|
||||
"- R: Toggle viewing all loaded chunks\n"
|
||||
"- I: Inventory menu\n"
|
||||
"- ESC: This menu\n"
|
||||
"- T: Chat\n"
|
||||
)), rect, false, true, this, 258);
|
||||
wchar_t* text = wgettext("Default Controls:\n"
|
||||
"- WASD: Walk\n"
|
||||
"- Mouse left: dig/hit\n"
|
||||
"- Mouse right: place/use\n"
|
||||
"- Mouse wheel: select item\n"
|
||||
"- 0...9: select item\n"
|
||||
"- Shift: sneak\n"
|
||||
"- R: Toggle viewing all loaded chunks\n"
|
||||
"- I: Inventory menu\n"
|
||||
"- ESC: This menu\n"
|
||||
"- T: Chat\n"
|
||||
);
|
||||
Environment->addStaticText(text, rect, false, true, this, 258);
|
||||
delete[] text;
|
||||
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 180, 220);
|
||||
|
@ -127,8 +127,10 @@ void GUITextInputMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, 30);
|
||||
rect = rect + v2s32(size.X/2-140/2, size.Y/2-30/2+25);
|
||||
wchar_t* text = wgettext("Proceed");
|
||||
Environment->addButton(rect, this, 257,
|
||||
wgettext("Proceed"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
changeCtype("C");
|
||||
}
|
||||
|
@ -105,8 +105,10 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 120, 20);
|
||||
rect = rect + v2s32(size.X/2-60, size.Y/2-35);
|
||||
Environment->addStaticText(wgettext("Sound Volume: "), rect, false,
|
||||
wchar_t* text = wgettext("Sound Volume: ");
|
||||
Environment->addStaticText(text, rect, false,
|
||||
true, this, ID_soundText1);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 30, 20);
|
||||
@ -117,8 +119,10 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 80, 30);
|
||||
rect = rect + v2s32(size.X/2-80/2, size.Y/2+55);
|
||||
wchar_t* text = wgettext("Exit");
|
||||
Environment->addButton(rect, this, ID_soundExitButton,
|
||||
wgettext("Exit"));
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 300, 20);
|
||||
|
@ -1501,7 +1501,9 @@ int main(int argc, char *argv[])
|
||||
while(device->run() && kill == false)
|
||||
{
|
||||
// Set the window caption
|
||||
device->setWindowCaption((std::wstring(L"Minetest [")+wgettext("Main Menu")+L"]").c_str());
|
||||
wchar_t* text = wgettext("Main Menu");
|
||||
device->setWindowCaption((std::wstring(L"Minetest [")+text+L"]").c_str());
|
||||
delete[] text;
|
||||
|
||||
// This is used for catching disconnects
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user