@@ -2041,12 +2041,16 @@ ItemStack GUIFormSpecMenu::verifySelectedItem()
2041
2041
return ItemStack ();
2042
2042
}
2043
2043
2044
- void GUIFormSpecMenu::acceptInput ()
2044
+ void GUIFormSpecMenu::acceptInput (bool quit= false )
2045
2045
{
2046
2046
if (m_text_dst)
2047
2047
{
2048
2048
std::map<std::string, std::string> fields;
2049
2049
2050
+ if (quit) {
2051
+ fields[" quit" ] = " true" ;
2052
+ }
2053
+
2050
2054
if (current_keys_pending.key_down ) {
2051
2055
fields[" key_down" ] = " true" ;
2052
2056
current_keys_pending.key_down = false ;
@@ -2188,10 +2192,12 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
2188
2192
if (event.KeyInput .PressedDown && (kp == EscapeKey ||
2189
2193
kp == getKeySetting (" keymap_inventory" )))
2190
2194
{
2191
- if (m_allowclose)
2195
+ if (m_allowclose) {
2196
+ acceptInput (true );
2192
2197
quitMenu ();
2193
- else
2198
+ } else {
2194
2199
m_text_dst->gotText (narrow_to_wide (" MenuQuit" ));
2200
+ }
2195
2201
return true ;
2196
2202
}
2197
2203
if (event.KeyInput .PressedDown &&
@@ -2204,7 +2210,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
2204
2210
switch (event.KeyInput .Key ) {
2205
2211
case KEY_RETURN:
2206
2212
if (m_allowclose) {
2207
- acceptInput ();
2213
+ acceptInput (true );
2208
2214
quitMenu ();
2209
2215
}
2210
2216
else
@@ -2551,11 +2557,13 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
2551
2557
unsigned int btn_id = event.GUIEvent .Caller ->getID ();
2552
2558
2553
2559
if (btn_id == 257 ) {
2554
- acceptInput ();
2555
- if (m_allowclose)
2560
+ if (m_allowclose) {
2561
+ acceptInput ( true );
2556
2562
quitMenu ();
2557
- else
2563
+ } else {
2564
+ acceptInput ();
2558
2565
m_text_dst->gotText (narrow_to_wide (" ExitButton" ));
2566
+ }
2559
2567
// quitMenu deallocates menu
2560
2568
return true ;
2561
2569
}
@@ -2572,10 +2580,12 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
2572
2580
s.send = true ;
2573
2581
acceptInput ();
2574
2582
if (s.is_exit ){
2575
- if (m_allowclose)
2583
+ if (m_allowclose) {
2584
+ acceptInput (true );
2576
2585
quitMenu ();
2577
- else
2586
+ } else {
2578
2587
m_text_dst->gotText (narrow_to_wide (" ExitButton" ));
2588
+ }
2579
2589
return true ;
2580
2590
}else {
2581
2591
s.send = false ;
@@ -2590,7 +2600,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
2590
2600
{
2591
2601
2592
2602
if (m_allowclose) {
2593
- acceptInput ();
2603
+ acceptInput (true );
2594
2604
quitMenu ();
2595
2605
}
2596
2606
else {
1 commit comments
4aiman commentedon Nov 6, 2013
Finally :-)