[colobot] 312/390: Fixed cheat console in main menu

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit 2f5d4e3b2f4123dc15c4d97317fd2d68d353ec38
Author: krzys-h <krzys_h at interia.pl>
Date:   Mon Apr 6 17:23:18 2015 +0200

    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 c617604..6b0f949 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<Ui::CEdit*>(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<Ui::CEdit*>(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 be66d15..ce5ada4 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;
         }
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list