summaryrefslogtreecommitdiffstats
path: root/src/control/CarCtrl.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-04 13:57:49 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-04 13:57:49 +0200
commitd1a46c35ce4012e74b8a9955d8e6e4dcc562b57d (patch)
treee085d805f553bc43d77bbd6adf287d362b556d38 /src/control/CarCtrl.cpp
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadre3-d1a46c35ce4012e74b8a9955d8e6e4dcc562b57d.tar
re3-d1a46c35ce4012e74b8a9955d8e6e4dcc562b57d.tar.gz
re3-d1a46c35ce4012e74b8a9955d8e6e4dcc562b57d.tar.bz2
re3-d1a46c35ce4012e74b8a9955d8e6e4dcc562b57d.tar.lz
re3-d1a46c35ce4012e74b8a9955d8e6e4dcc562b57d.tar.xz
re3-d1a46c35ce4012e74b8a9955d8e6e4dcc562b57d.tar.zst
re3-d1a46c35ce4012e74b8a9955d8e6e4dcc562b57d.zip
Diffstat (limited to '')
-rw-r--r--src/control/CarCtrl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 2d946145..09571b7f 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -422,8 +422,11 @@ CCarCtrl::GenerateOneRandomCar()
#ifdef FIX_BUGS
/* Casting timer to float is very unwanted. In this case it's not awful */
/* but in CAutoPilot::ModifySpeed it can even cause crashes (see SilentPatch). */
+
+ /* Second fix: adding 0.5f is a mistake. It should be between 0 and 1. It was fixed in SA.*/
+ /* It is also correct in CAutoPilot::ModifySpeed. */
pCar->AutoPilot.m_nTimeEnteredCurve = CTimer::GetTimeInMilliseconds() -
- (uint32)((0.5f + positionBetweenNodes) * pCar->AutoPilot.m_nTimeToSpendOnCurrentCurve);
+ (uint32)(positionBetweenNodes * pCar->AutoPilot.m_nTimeToSpendOnCurrentCurve);
#else
pCar->AutoPilot.m_nTimeEnteredCurve = CTimer::GetTimeInMilliseconds() -
(0.5f + positionBetweenNodes) * pCar->AutoPilot.m_nTimeToSpendOnCurrentCurve;