Setting speed now works. Added ability to set 4x and 8x using "speed4" and "speed8" cheat codes respectively.

dev-ui
adiblol 2012-10-06 23:35:27 +02:00
parent 2414861175
commit 7818d5d096
2 changed files with 24 additions and 5 deletions

View File

@ -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();
}

View File

@ -383,6 +383,7 @@ protected:
void StopDisplayVisit();
void ExecuteCmd(char *cmd);
bool TestGadgetQuantity(int rank);
void UpdateSpeedLabel();
protected:
CInstanceManager* m_iMan;