Skip to content

Commit af01a95

Browse files
sapiersapier
sapier
authored and
sapier
committedApr 1, 2014
Fix lost change password button
1 parent 65d1cb8 commit af01a95

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed
 

‎src/game.cpp

+30-15
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ struct LocalFormspecHandler : public TextDest
154154
return;
155155
}
156156

157+
if (fields.find("btn_change_password") != fields.end()) {
158+
g_gamecallback->changePassword();
159+
return;
160+
}
161+
157162
if (fields.find("quit") != fields.end()) {
158163
return;
159164
}
@@ -1000,7 +1005,7 @@ static void show_chat_menu(FormspecFormSource* current_formspec,
10001005
/******************************************************************************/
10011006
static void show_pause_menu(FormspecFormSource* current_formspec,
10021007
TextDest* current_textdest, IWritableTextureSource* tsrc,
1003-
IrrlichtDevice * device)
1008+
IrrlichtDevice * device, bool singleplayermode)
10041009
{
10051010

10061011
std::string control_text = wide_to_narrow(wstrgettext("Default Controls:\n"
@@ -1016,25 +1021,34 @@ static void show_pause_menu(FormspecFormSource* current_formspec,
10161021
"- T: chat\n"
10171022
));
10181023

1024+
float ypos = singleplayermode ? 1.0 : 0.5;
10191025
std::ostringstream os;
1020-
os<<"Minetest\n";
1021-
os<<minetest_build_info<<"\n";
1022-
os<<"path_user = "<<wrap_rows(porting::path_user, 20)<<"\n";
10231026

1024-
std::string formspec =
1025-
"size[11,5.5,true]"
1026-
"button_exit[4,1;3,0.5;btn_continue;" + wide_to_narrow(wstrgettext("Continue")) + "]"
1027-
"button_exit[4,2;3,0.5;btn_sound;" + wide_to_narrow(wstrgettext("Sound Volume")) + "]"
1028-
"button_exit[4,3;3,0.5;btn_exit_menu;" + wide_to_narrow(wstrgettext("Exit to Menu")) + "]"
1029-
"button_exit[4,4;3,0.5;btn_exit_os;" + wide_to_narrow(wstrgettext("Exit to OS")) + "]"
1030-
"textarea[7.5,0.25;3.75,6;;" + control_text + ";]"
1031-
"textarea[0.4,0.25;3.5,6;;" + os.str() + ";]"
1032-
;
1027+
os << "size[11,5.5,true]"
1028+
<< "button_exit[4," << (ypos++) << ";3,0.5;btn_continue;"
1029+
<< wide_to_narrow(wstrgettext("Continue")) << "]";
1030+
1031+
if (!singleplayermode) {
1032+
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
1033+
<< wide_to_narrow(wstrgettext("Change Password")) << "]";
1034+
}
1035+
1036+
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
1037+
<< wide_to_narrow(wstrgettext("Sound Volume")) << "]";
1038+
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
1039+
<< wide_to_narrow(wstrgettext("Exit to Menu")) << "]";
1040+
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
1041+
<< wide_to_narrow(wstrgettext("Exit to OS")) << "]"
1042+
<< "textarea[7.5,0.25;3.75,6;;" << control_text << ";]"
1043+
<< "textarea[0.4,0.25;3.5,6;;" << "Minetest\n"
1044+
<< minetest_build_info << "\n"
1045+
<< "path_user = " << wrap_rows(porting::path_user, 20)
1046+
<< "\n;]";
10331047

10341048
/* Create menu */
10351049
/* Note: FormspecFormSource and LocalFormspecHandler *
10361050
* are deleted by guiFormSpecMenu */
1037-
current_formspec = new FormspecFormSource(formspec,&current_formspec);
1051+
current_formspec = new FormspecFormSource(os.str(),&current_formspec);
10381052
current_textdest = new LocalFormspecHandler("MT_PAUSE_MENU");
10391053
GUIFormSpecMenu *menu =
10401054
new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, NULL, NULL, tsrc);
@@ -1894,7 +1908,8 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
18941908
}
18951909
else if(input->wasKeyDown(EscapeKey))
18961910
{
1897-
show_pause_menu(current_formspec, current_textdest, tsrc, device);
1911+
show_pause_menu(current_formspec, current_textdest, tsrc, device,
1912+
simple_singleplayer_mode);
18981913
}
18991914
else if(input->wasKeyDown(getKeySetting("keymap_chat")))
19001915
{

0 commit comments

Comments
 (0)