summaryrefslogtreecommitdiffstats
path: root/src/control/CarCtrl.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-11 20:04:35 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-11 20:04:35 +0200
commit8fae2dcc263cd8edeb7d2f55c95369457d6d2ded (patch)
tree71e551e81fa2cce105d65fe95a1972cc0716ea0c /src/control/CarCtrl.cpp
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
downloadre3-8fae2dcc263cd8edeb7d2f55c95369457d6d2ded.tar
re3-8fae2dcc263cd8edeb7d2f55c95369457d6d2ded.tar.gz
re3-8fae2dcc263cd8edeb7d2f55c95369457d6d2ded.tar.bz2
re3-8fae2dcc263cd8edeb7d2f55c95369457d6d2ded.tar.lz
re3-8fae2dcc263cd8edeb7d2f55c95369457d6d2ded.tar.xz
re3-8fae2dcc263cd8edeb7d2f55c95369457d6d2ded.tar.zst
re3-8fae2dcc263cd8edeb7d2f55c95369457d6d2ded.zip
Diffstat (limited to 'src/control/CarCtrl.cpp')
-rw-r--r--src/control/CarCtrl.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 720c269d..7c17db34 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -2628,14 +2628,10 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
float changeMultiplier = 0.002f * CTimer::GetTimeStep();
if (distanceToTarget < 5.0f)
changeMultiplier /= 5.0f;
- if (vecSpeedChangeLength < changeMultiplier) {
- pHeli->m_vecMoveSpeed.x = vecAdvanceThisFrame.x;
- pHeli->m_vecMoveSpeed.y = vecAdvanceThisFrame.y;
- }
- else {
- pHeli->m_vecMoveSpeed.x += vecSpeedChange.x * changeMultiplier;
- pHeli->m_vecMoveSpeed.y += vecSpeedChange.y * changeMultiplier;
- }
+ if (vecSpeedChangeLength < changeMultiplier)
+ pHeli->AddToMoveSpeed(vecAdvanceThisFrame);
+ else
+ pHeli->AddToMoveSpeed(vecSpeedChange * changeMultiplier);
pHeli->SetPosition(pHeli->GetPosition() + CVector(CTimer::GetTimeStep() * pHeli->m_vecMoveSpeed.x, CTimer::GetTimeStep() * pHeli->m_vecMoveSpeed.y, 0.0f));
assert(0);
// This is not finished yet. Heli fields in CAutomobile required