prevent AI SpeedCtrlPowerInc deadlock

This commit is contained in:
milek7
2020-11-15 17:48:29 +01:00
parent 54812e8346
commit 9bac45e35b
3 changed files with 25 additions and 15 deletions

View File

@@ -3893,17 +3893,17 @@ void TController::SpeedSet()
void TController::SpeedCntrl(double DesiredSpeed)
{
if (mvControlling->SpeedCtrlUnit.PowerStep > 0) {
while (mvControlling->SpeedCtrlUnit.DesiredPower < mvControlling->SpeedCtrlUnit.MaxPower)
{
mvControlling->SpeedCtrlPowerInc();
}
if (!mvControlling->ScndCtrlPos)
mvControlling->IncScndCtrl(1);
while (mvControlling->SpeedCtrlUnit.DesiredPower < mvControlling->SpeedCtrlUnit.MaxPower
&& mvControlling->SpeedCtrlPowerInc());
}
if (mvControlling->EngineType == TEngineType::DieselEngine)
{
if (DesiredSpeed < 0.1) {
mvControlling->DecScndCtrl(2);
DesiredSpeed = 0;
}
}
else if (mvControlling->ScndCtrlPos < 1) {
mvControlling->IncScndCtrl(1);
}