Merge pull request #1578 from JoePfeiffer/fix-1575

If we don't have any events left in the queue, shouldn't advance time
This commit is contained in:
SiboVG 2022-08-10 21:03:01 +02:00 committed by GitHub
commit d2a04d2c64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,8 +130,8 @@ public class BasicEventSimulationEngine implements SimulationEngine {
double oldAlt = currentStatus.getRocketPosition().z;
if (SimulationListenerHelper.firePreStep(currentStatus)) {
// Step at most to the next event
double maxStepTime = Double.MAX_VALUE;
// Step at most to the next event. If there is no next event, don't step time
double maxStepTime = 0.0;
FlightEvent nextEvent = currentStatus.getEventQueue().peek();
if (nextEvent != null) {
maxStepTime = MathUtil.max(nextEvent.getTime() - currentStatus.getSimulationTime(), 0.001);