From 2123531f14a1b7c95d222af7861ae84abceb3744 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Sun, 24 Dec 2023 06:20:21 -0700 Subject: [PATCH] Create new SIM_ABORT FlightEvent --- core/resources/l10n/messages.properties | 1 + .../net/sf/openrocket/simulation/FlightEvent.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 91d36773e..d322f4a35 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1964,6 +1964,7 @@ FlightEvent.Type.STAGE_SEPARATION = Stage separation FlightEvent.Type.APOGEE = Apogee FlightEvent.Type.RECOVERY_DEVICE_DEPLOYMENT = Recovery device deployment FlightEvent.Type.GROUND_HIT = Ground hit +FlightEvent.Type.SIM_ABORT = Simulation abort FlightEvent.Type.SIMULATION_END = Simulation end FlightEvent.Type.ALTITUDE = Altitude change FlightEvent.Type.TUMBLE = Tumbling diff --git a/core/src/net/sf/openrocket/simulation/FlightEvent.java b/core/src/net/sf/openrocket/simulation/FlightEvent.java index e76d45e0b..54a675201 100644 --- a/core/src/net/sf/openrocket/simulation/FlightEvent.java +++ b/core/src/net/sf/openrocket/simulation/FlightEvent.java @@ -1,6 +1,7 @@ package net.sf.openrocket.simulation; import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.logging.SimulationAbort; import net.sf.openrocket.rocketcomponent.AxialStage; import net.sf.openrocket.rocketcomponent.MotorMount; import net.sf.openrocket.rocketcomponent.RocketComponent; @@ -80,9 +81,15 @@ public class FlightEvent implements Comparable { * The rocket begins to tumble. */ TUMBLE(trans.get("FlightEvent.Type.TUMBLE")), + + /** + * It is impossible for the simulation proceed due to characteristics + * of the rocket or flight configuration + */ + SIM_ABORT(trans.get("FlightEvent.Type.SIM_ABORT")), /** - * Simulation aborted + * Simulation exception thrown due to error in OpenRocket code */ EXCEPTION(trans.get("FlightEvent.Type.EXCEPTION")); @@ -239,6 +246,11 @@ public class FlightEvent implements Comparable { } } break; + case SIM_ABORT: + if (( null == this.data ) || ( ! ( this.data instanceof SimulationAbort ))) { + throw new IllegalStateException(type.name()+" events require SimulationAbort objects"); + } + break; case LAUNCH: case LIFTOFF: case LAUNCHROD: