summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authoradiblol <adiblol@hydrogen>2012-10-06 23:35:27 +0200
committeradiblol <adiblol@hydrogen>2012-10-06 23:35:27 +0200
commit7818d5d0963f6e57540b1abdf83408ea6009c296 (patch)
tree1e1ad35f8e3341f3c5466bd24ad8b4f67f9017e0 /src/object
parent241486117535a540ac16894a3a08244c293eb680 (diff)
downloadcolobot-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')
-rw-r--r--src/object/robotmain.cpp28
-rw-r--r--src/object/robotmain.h1
2 files changed, 24 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();
}
diff --git a/src/object/robotmain.h b/src/object/robotmain.h
index 70fbc8d..dddd6d4 100644
--- a/src/object/robotmain.h
+++ b/src/object/robotmain.h
@@ -383,6 +383,7 @@ protected:
void StopDisplayVisit();
void ExecuteCmd(char *cmd);
bool TestGadgetQuantity(int rank);
+ void UpdateSpeedLabel();
protected:
CInstanceManager* m_iMan;