1
0
Fork 0

Fix infinite loop on negative speed.

This commit is contained in:
Stuart Buchanan 2021-08-01 20:51:18 +01:00
parent 5ef5ff1b37
commit a3b01a1c1e

View file

@ -1006,7 +1006,7 @@ bool FGAIShip::advanceFlightPlan (double start_sec, double day_sec) {
} else {
distance_nm = getRange(prev->getLatitude(), prev->getLongitude(), curr->getLatitude(), curr->getLongitude());
elapsed_sec += distance_nm * 60 * 60 / prev->getSpeed();
elapsed_sec += distance_nm * 60 * 60 / fabs(prev->getSpeed());
if (elapsed_sec >= day_sec)
continue;