aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-03-31 22:50:03 +0200
committersapier <Sapier at GMX dot net>2014-04-01 22:38:34 +0200
commitaf01a9577e488d17e4f2f9145db723f3902446c9 (patch)
tree885d219d00014e9b062f467e0fdac7fbdf278f46 /src
parent65d1cb8321d4a0519ded130c69ca16a1b9d8a3cc (diff)
downloadminetest-af01a9577e488d17e4f2f9145db723f3902446c9.tar.gz
minetest-af01a9577e488d17e4f2f9145db723f3902446c9.tar.bz2
minetest-af01a9577e488d17e4f2f9145db723f3902446c9.zip
Fix lost change password button
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 761f65f83..a13f1393c 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -154,6 +154,11 @@ struct LocalFormspecHandler : public TextDest
return;
}
+ if (fields.find("btn_change_password") != fields.end()) {
+ g_gamecallback->changePassword();
+ return;
+ }
+
if (fields.find("quit") != fields.end()) {
return;
}
@@ -1000,7 +1005,7 @@ static void show_chat_menu(FormspecFormSource* current_formspec,
/******************************************************************************/
static void show_pause_menu(FormspecFormSource* current_formspec,
TextDest* current_textdest, IWritableTextureSource* tsrc,
- IrrlichtDevice * device)
+ IrrlichtDevice * device, bool singleplayermode)
{
std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
@@ -1016,25 +1021,34 @@ static void show_pause_menu(FormspecFormSource* current_formspec,
"- T: chat\n"
));
+ float ypos = singleplayermode ? 1.0 : 0.5;
std::ostringstream os;
- os<<"Minetest\n";
- os<<minetest_build_info<<"\n";
- os<<"path_user = "<<wrap_rows(porting::path_user, 20)<<"\n";
- std::string formspec =
- "size[11,5.5,true]"
- "button_exit[4,1;3,0.5;btn_continue;" + wide_to_narrow(wstrgettext("Continue")) + "]"
- "button_exit[4,2;3,0.5;btn_sound;" + wide_to_narrow(wstrgettext("Sound Volume")) + "]"
- "button_exit[4,3;3,0.5;btn_exit_menu;" + wide_to_narrow(wstrgettext("Exit to Menu")) + "]"
- "button_exit[4,4;3,0.5;btn_exit_os;" + wide_to_narrow(wstrgettext("Exit to OS")) + "]"
- "textarea[7.5,0.25;3.75,6;;" + control_text + ";]"
- "textarea[0.4,0.25;3.5,6;;" + os.str() + ";]"
- ;
+ os << "size[11,5.5,true]"
+ << "button_exit[4," << (ypos++) << ";3,0.5;btn_continue;"
+ << wide_to_narrow(wstrgettext("Continue")) << "]";
+
+ if (!singleplayermode) {
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
+ << wide_to_narrow(wstrgettext("Change Password")) << "]";
+ }
+
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
+ << wide_to_narrow(wstrgettext("Sound Volume")) << "]";
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
+ << wide_to_narrow(wstrgettext("Exit to Menu")) << "]";
+ os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
+ << wide_to_narrow(wstrgettext("Exit to OS")) << "]"
+ << "textarea[7.5,0.25;3.75,6;;" << control_text << ";]"
+ << "textarea[0.4,0.25;3.5,6;;" << "Minetest\n"
+ << minetest_build_info << "\n"
+ << "path_user = " << wrap_rows(porting::path_user, 20)
+ << "\n;]";
/* Create menu */
/* Note: FormspecFormSource and LocalFormspecHandler *
* are deleted by guiFormSpecMenu */
- current_formspec = new FormspecFormSource(formspec,&current_formspec);
+ current_formspec = new FormspecFormSource(os.str(),&current_formspec);
current_textdest = new LocalFormspecHandler("MT_PAUSE_MENU");
GUIFormSpecMenu *menu =
new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, NULL, NULL, tsrc);
@@ -1894,7 +1908,8 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
}
else if(input->wasKeyDown(EscapeKey))
{
- show_pause_menu(current_formspec, current_textdest, tsrc, device);
+ show_pause_menu(current_formspec, current_textdest, tsrc, device,
+ simple_singleplayer_mode);
}
else if(input->wasKeyDown(getKeySetting("keymap_chat")))
{