From f5cc1f61bfe50854b63c64ca789453d9f2762498 Mon Sep 17 00:00:00 2001 From: Peter Tsongalis Date: Sun, 12 Jun 2022 12:32:33 -0700 Subject: [PATCH] [1373] Display warning when no recovery device configured --- core/resources/l10n/messages.properties | 1 + core/src/net/sf/openrocket/aerodynamics/Warning.java | 2 ++ .../sf/openrocket/simulation/BasicEventSimulationEngine.java | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 76597dbaf..0a33eaaef 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1787,6 +1787,7 @@ Warning.PARALLEL_FINS = Too many parallel fins Warning.SUPERSONIC = Body calculations may not be entirely accurate at supersonic speeds. Warning.RECOVERY_LAUNCH_ROD = Recovery device device deployed while on the launch guide. Warning.RECOVERY_HIGH_SPEED = Recovery device deployment at high speed +Warning.NO_RECOVERY_DEVICE = No recovery device defined in the simulation. Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust. Warning.EVENT_AFTER_LANDING = Flight Event occurred after landing: Warning.ZERO_LENGTH_BODY = Zero length bodies may not result in accurate simulations. diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index bda67ed61..b48a35a5e 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -375,6 +375,8 @@ public abstract class Warning { ////Recovery device opened while motor still burning. public static final Warning RECOVERY_DEPLOYMENT_WHILE_BURNING = new Other(trans.get("Warning.RECOVERY_DEPLOYMENT_WHILE_BURNING")); + ////No recovery device for simulation + public static final Warning NO_RECOVERY_DEVICE = new Other(trans.get("Warning.NO_RECOVERY_DEVICE")); //// Invalid parameter encountered, ignoring. public static final Warning FILE_INVALID_PARAMETER = new Other(trans.get("Warning.FILE_INVALID_PARAMETER")); diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index c17daff2d..8fdae800a 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -344,6 +344,11 @@ public class BasicEventSimulationEngine implements SimulationEngine { } } + // Add a warning if there is no recovery device defined. + if (!currentStatus.getConfiguration().hasRecoveryDevice()) { + currentStatus.getWarnings().add(Warning.NO_RECOVERY_DEVICE); + } + // Handle event log.trace("Handling event " + event); switch (event.getType()) {