@@ -154,6 +154,11 @@ struct LocalFormspecHandler : public TextDest
154
154
return ;
155
155
}
156
156
157
+ if (fields.find (" btn_change_password" ) != fields.end ()) {
158
+ g_gamecallback->changePassword ();
159
+ return ;
160
+ }
161
+
157
162
if (fields.find (" quit" ) != fields.end ()) {
158
163
return ;
159
164
}
@@ -1000,7 +1005,7 @@ static void show_chat_menu(FormspecFormSource* current_formspec,
1000
1005
/* *****************************************************************************/
1001
1006
static void show_pause_menu (FormspecFormSource* current_formspec,
1002
1007
TextDest* current_textdest, IWritableTextureSource* tsrc,
1003
- IrrlichtDevice * device)
1008
+ IrrlichtDevice * device, bool singleplayermode )
1004
1009
{
1005
1010
1006
1011
std::string control_text = wide_to_narrow (wstrgettext (" Default Controls:\n "
@@ -1016,25 +1021,34 @@ static void show_pause_menu(FormspecFormSource* current_formspec,
1016
1021
" - T: chat\n "
1017
1022
));
1018
1023
1024
+ float ypos = singleplayermode ? 1.0 : 0.5 ;
1019
1025
std::ostringstream os;
1020
- os<<" Minetest\n " ;
1021
- os<<minetest_build_info<<" \n " ;
1022
- os<<" path_user = " <<wrap_rows (porting::path_user, 20 )<<" \n " ;
1023
1026
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 ;]" ;
1033
1047
1034
1048
/* Create menu */
1035
1049
/* Note: FormspecFormSource and LocalFormspecHandler *
1036
1050
* are deleted by guiFormSpecMenu */
1037
- current_formspec = new FormspecFormSource (formspec ,¤t_formspec);
1051
+ current_formspec = new FormspecFormSource (os. str () ,¤t_formspec);
1038
1052
current_textdest = new LocalFormspecHandler (" MT_PAUSE_MENU" );
1039
1053
GUIFormSpecMenu *menu =
1040
1054
new GUIFormSpecMenu (device, guiroot, -1 , &g_menumgr, NULL , NULL , tsrc);
@@ -1894,7 +1908,8 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
1894
1908
}
1895
1909
else if (input->wasKeyDown (EscapeKey))
1896
1910
{
1897
- show_pause_menu (current_formspec, current_textdest, tsrc, device);
1911
+ show_pause_menu (current_formspec, current_textdest, tsrc, device,
1912
+ simple_singleplayer_mode);
1898
1913
}
1899
1914
else if (input->wasKeyDown (getKeySetting (" keymap_chat" )))
1900
1915
{
0 commit comments