From 2f5d4e3b2f4123dc15c4d97317fd2d68d353ec38 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Mon, 6 Apr 2015 17:23:18 +0200 Subject: [PATCH] Fixed cheat console in main menu --- src/object/robotmain.cpp | 22 ++++++++++++---------- src/ui/maindialog.cpp | 18 ++++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index c6176043..6b0f949a 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -688,18 +688,20 @@ bool CRobotMain::ProcessEvent(Event &event) } // Management of the console. - if (m_phase != PHASE_NAME && - !m_movie->IsExist() && - !m_movieLock && !m_editLock && !m_engine->GetPause() && - event.type == EVENT_KEY_DOWN && + if (event.type == EVENT_KEY_DOWN && event.key.key == KEY(BACKQUOTE)) // Pause ? { - Ui::CEdit* pe = static_cast(m_interface->SearchControl(EVENT_CMD)); - if (pe == nullptr) return false; - pe->SetState(Ui::STATE_VISIBLE); - pe->SetFocus(true); - if (m_phase == PHASE_SIMUL) ChangePause(PAUSE_CHEAT); - m_cmdEdit = true; + if(m_phase != PHASE_NAME && + !m_movie->IsExist() && + !m_movieLock && !m_editLock && !m_engine->GetPause()) + { + Ui::CEdit* pe = static_cast(m_interface->SearchControl(EVENT_CMD)); + if (pe == nullptr) return false; + pe->SetState(Ui::STATE_VISIBLE); + pe->SetFocus(true); + if (m_phase == PHASE_SIMUL) ChangePause(PAUSE_CHEAT); + m_cmdEdit = true; + } return false; } if (event.type == EVENT_KEY_DOWN && diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index be66d159..ce5ada40 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -1845,17 +1845,17 @@ bool CMainDialog::EventProcess(const Event &event) if ( m_phase == PHASE_WELCOME1 && m_phaseTime >= welcomeLength ) { - ChangePhase(PHASE_WELCOME2); + m_main->ChangePhase(PHASE_WELCOME2); return true; } if ( m_phase == PHASE_WELCOME2 && m_phaseTime >= welcomeLength ) { - ChangePhase(PHASE_WELCOME3); + m_main->ChangePhase(PHASE_WELCOME3); return true; } if ( m_phase == PHASE_WELCOME3 && m_phaseTime >= welcomeLength ) { - ChangePhase(PHASE_NAME); + m_main->ChangePhase(PHASE_NAME); return true; } @@ -1984,7 +1984,9 @@ bool CMainDialog::EventProcess(const Event &event) //? StartQuit(); // would you leave? m_sound->Play(SOUND_TZOING); m_main->ChangePhase(PHASE_GENERIC); + return false; } + return true; break; case EVENT_INTERFACE_QUIT: @@ -2022,7 +2024,7 @@ bool CMainDialog::EventProcess(const Event &event) break; default: - break; + return true; } return false; } @@ -2271,7 +2273,7 @@ bool CMainDialog::EventProcess(const Event &event) break; default: - break; + return true; } return false; } @@ -2774,7 +2776,7 @@ bool CMainDialog::EventProcess(const Event &event) if ( event.type == EVENT_KEY_DOWN || event.type == EVENT_MOUSE_BUTTON_DOWN ) { - ChangePhase(PHASE_WELCOME2); + m_main->ChangePhase(PHASE_WELCOME2); return true; } } @@ -2783,7 +2785,7 @@ bool CMainDialog::EventProcess(const Event &event) if ( event.type == EVENT_KEY_DOWN || event.type == EVENT_MOUSE_BUTTON_DOWN ) { - ChangePhase(PHASE_WELCOME3); + m_main->ChangePhase(PHASE_WELCOME3); return true; } } @@ -2792,7 +2794,7 @@ bool CMainDialog::EventProcess(const Event &event) if ( event.type == EVENT_KEY_DOWN || event.type == EVENT_MOUSE_BUTTON_DOWN ) { - ChangePhase(PHASE_NAME); + m_main->ChangePhase(PHASE_NAME); return true; } }