Add warning when flight events remain in queue at ground hit time

(addresses issue #361)
This commit is contained in:
JoePfeiffer 2019-02-19 13:21:58 -07:00
parent 1abf0d3834
commit eeb82c4573
3 changed files with 38 additions and 1 deletions

View File

@ -1693,7 +1693,7 @@ Warning.SUPERSONIC = Body calculations may not be entirely accurate at supersoni
Warning.RECOVERY_LAUNCH_ROD = Recovery device device deployed while on the launch guide.
Warning.RECOVERY_HIGH_SPEED = Recovery device deployment at high speed
Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust.
Warning.EVENT_REMAINING = Event still in queue at ground hit:
! Scale dialog
ScaleDialog.lbl.scaleRocket = Entire rocket

View File

@ -3,6 +3,7 @@ package net.sf.openrocket.aerodynamics;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.motor.Motor;
import net.sf.openrocket.startup.Application;
import net.sf.openrocket.simulation.FlightEvent;
import net.sf.openrocket.unit.UnitGroup;
public abstract class Warning {
@ -123,6 +124,33 @@ public abstract class Warning {
return false;
}
}
/**
* A <code>Warning</code> indicating flight events remain in the event queue on ground hit.
*
*/
public static class EventRemaining extends Warning {
private FlightEvent event;
/**
* Sole constructor. The argument is an event remaining in the queue
*
* @param event the event that caused this warning
*/
public EventRemaining(FlightEvent _event) {
this.event = _event;
}
@Override
public String toString() {
return trans.get("Warning.EVENT_REMAINING") + event.getType();
}
@Override
public boolean replaceBy(Warning other) {
return false;
}
}
public static class MissingMotor extends Warning {
@ -350,5 +378,7 @@ public abstract class Warning {
public static final Warning RECOVERY_LAUNCH_ROD = new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD"));
public static final Warning TUMBLE_UNDER_THRUST = new Other(trans.get("Warning.TUMBLE_UNDER_THRUST"));
public static final Warning EVENT_REMAINING = new Other(trans.get("Warning.EVENT_REMAINING"));
}

View File

@ -487,6 +487,13 @@ public class BasicEventSimulationEngine implements SimulationEngine {
break;
case GROUND_HIT:
// have I hit the ground while I still have events in the queue?
for (FlightEvent e : currentStatus.getEventQueue()) {
if ((e.getType() != FlightEvent.Type.ALTITUDE) &&
(e.getType() != FlightEvent.Type.SIMULATION_END))
currentStatus.getWarnings().add(new Warning.EventRemaining(e));
}
currentStatus.getFlightData().addEvent(event);
break;