return ItemStack();
}
-void GUIFormSpecMenu::acceptInput()
+void GUIFormSpecMenu::acceptInput(bool quit=false)
{
if(m_text_dst)
{
std::map<std::string, std::string> fields;
+ if (quit) {
+ fields["quit"] = "true";
+ }
+
if (current_keys_pending.key_down) {
fields["key_down"] = "true";
current_keys_pending.key_down = false;
if (event.KeyInput.PressedDown && (kp == EscapeKey ||
kp == getKeySetting("keymap_inventory")))
{
- if (m_allowclose)
+ if (m_allowclose) {
+ acceptInput(true);
quitMenu();
- else
+ } else {
m_text_dst->gotText(narrow_to_wide("MenuQuit"));
+ }
return true;
}
if (event.KeyInput.PressedDown &&
switch (event.KeyInput.Key) {
case KEY_RETURN:
if (m_allowclose) {
- acceptInput();
+ acceptInput(true);
quitMenu();
}
else
unsigned int btn_id = event.GUIEvent.Caller->getID();
if (btn_id == 257) {
- acceptInput();
- if (m_allowclose)
+ if (m_allowclose) {
+ acceptInput(true);
quitMenu();
- else
+ } else {
+ acceptInput();
m_text_dst->gotText(narrow_to_wide("ExitButton"));
+ }
// quitMenu deallocates menu
return true;
}
s.send = true;
acceptInput();
if(s.is_exit){
- if (m_allowclose)
+ if (m_allowclose) {
+ acceptInput(true);
quitMenu();
- else
+ } else {
m_text_dst->gotText(narrow_to_wide("ExitButton"));
+ }
return true;
}else{
s.send = false;
{
if (m_allowclose) {
- acceptInput();
+ acceptInput(true);
quitMenu();
}
else {
void updateSelectedItem();
ItemStack verifySelectedItem();
- void acceptInput();
+ void acceptInput(bool quit);
bool preprocessEvent(const SEvent& event);
bool OnEvent(const SEvent& event);