diff options
author | adiblol <adiblol@hydrogen> | 2012-10-06 23:35:27 +0200 |
---|---|---|
committer | adiblol <adiblol@hydrogen> | 2012-10-06 23:35:27 +0200 |
commit | 7818d5d0963f6e57540b1abdf83408ea6009c296 (patch) | |
tree | 1e1ad35f8e3341f3c5466bd24ad8b4f67f9017e0 /src/object/robotmain.cpp | |
parent | 241486117535a540ac16894a3a08244c293eb680 (diff) | |
download | colobot-7818d5d0963f6e57540b1abdf83408ea6009c296.tar.gz colobot-7818d5d0963f6e57540b1abdf83408ea6009c296.tar.bz2 colobot-7818d5d0963f6e57540b1abdf83408ea6009c296.zip |
Setting speed now works. Added ability to set 4x and 8x using "speed4" and "speed8" cheat codes respectively.
Diffstat (limited to 'src/object/robotmain.cpp')
-rw-r--r-- | src/object/robotmain.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 82eac2b..1a8c934 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -1956,6 +1956,17 @@ void CRobotMain::ExecuteCmd(char *cmd) return; } + if (strcmp(cmd, "speed4") == 0) { + SetSpeed(4.0f); + UpdateSpeedLabel(); + return; + } + if (strcmp(cmd, "speed8") == 0) { + SetSpeed(8.0f); + UpdateSpeedLabel(); + return; + } + if (m_phase == PHASE_SIMUL) m_displayText->DisplayError(ERR_CMD, Math::Vector(0.0f,0.0f,0.0f)); } @@ -6615,9 +6626,20 @@ void CRobotMain::ChangePause(bool pause) //! Changes game speed void CRobotMain::SetSpeed(float speed) { - // TODO: m_app->SetSimulationSpeed(speed); + m_app->SetSimulationSpeed(speed); + UpdateSpeedLabel(); +} + +float CRobotMain::GetSpeed() +{ + return m_app->GetSimulationSpeed(); +} +void CRobotMain::UpdateSpeedLabel() +{ Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_SPEED)); + float speed = m_app->GetSimulationSpeed(); + if (pb != nullptr) { if (speed == 1.0f) @@ -6632,11 +6654,7 @@ void CRobotMain::SetSpeed(float speed) pb->SetState(Ui::STATE_VISIBLE); } } -} -float CRobotMain::GetSpeed() -{ - return m_app->GetSimulationSpeed(); } |