From 7818d5d0963f6e57540b1abdf83408ea6009c296 Mon Sep 17 00:00:00 2001 From: adiblol Date: Sat, 6 Oct 2012 23:35:27 +0200 Subject: Setting speed now works. Added ability to set 4x and 8x using "speed4" and "speed8" cheat codes respectively. --- src/object/robotmain.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/object/robotmain.cpp') 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(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(); } -- cgit v1.2.3-1-g7c22