summaryrefslogtreecommitdiffstats
path: root/src/control/CarCtrl.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-01-31 18:16:13 +0100
committerSergeanur <s.anureev@yandex.ua>2020-01-31 18:16:13 +0100
commit79d2ab7619eef2fe0c437e368bd287f2a0b1b590 (patch)
tree1b1f593a94e92e51874f9bae3e742ae3cfa95568 /src/control/CarCtrl.cpp
parentFixing IS_AREA_OCCUPIED command (diff)
downloadre3-79d2ab7619eef2fe0c437e368bd287f2a0b1b590.tar
re3-79d2ab7619eef2fe0c437e368bd287f2a0b1b590.tar.gz
re3-79d2ab7619eef2fe0c437e368bd287f2a0b1b590.tar.bz2
re3-79d2ab7619eef2fe0c437e368bd287f2a0b1b590.tar.lz
re3-79d2ab7619eef2fe0c437e368bd287f2a0b1b590.tar.xz
re3-79d2ab7619eef2fe0c437e368bd287f2a0b1b590.tar.zst
re3-79d2ab7619eef2fe0c437e368bd287f2a0b1b590.zip
Diffstat (limited to '')
-rw-r--r--src/control/CarCtrl.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index fe727f72..209a5e21 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -796,8 +796,8 @@ CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle)
float
CCarCtrl::FindMaximumSpeedForThisCarInTraffic(CVehicle* pVehicle)
{
- if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY ||
- pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE)
+ if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_AVOID_CARS ||
+ pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_PLOUGH_THROUGH)
return pVehicle->AutoPilot.m_nCruiseSpeed;
float left = pVehicle->GetPosition().x - DISTANCE_TO_SCAN_FOR_DANGER;
float right = pVehicle->GetPosition().x + DISTANCE_TO_SCAN_FOR_DANGER;
@@ -826,7 +826,7 @@ CCarCtrl::FindMaximumSpeedForThisCarInTraffic(CVehicle* pVehicle)
pVehicle->bWarnedPeds = true;
if (pVehicle->AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_STOP_FOR_CARS)
return maxSpeed;
- return (maxSpeed + pVehicle->AutoPilot.m_nDrivingStyle) / 2;
+ return (maxSpeed + pVehicle->AutoPilot.m_nCruiseSpeed) / 2;
}
void
@@ -873,13 +873,11 @@ CCarCtrl::SlowCarOnRailsDownForTrafficAndLights(CVehicle* pVehicle)
if (maxSpeed >= curSpeed){
if (maxSpeed > curSpeed)
pVehicle->AutoPilot.ModifySpeed(min(maxSpeed, curSpeed + 0.05f * CTimer::GetTimeStep()));
- }else{
- if (curSpeed == 0.0f)
- return;
- if (curSpeed >= 0.1f)
- pVehicle->AutoPilot.ModifySpeed(max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
- else if (curSpeed != 0.0f) /* no need to check */
+ }else if (curSpeed != 0.0f) {
+ if (curSpeed < 0.1f)
pVehicle->AutoPilot.ModifySpeed(0.0f);
+ else
+ pVehicle->AutoPilot.ModifySpeed(max(maxSpeed, curSpeed - 0.5f * CTimer::GetTimeStep()));
}
}
#if 0