From 7101aa4641957dbc5a53181245857faf48d80f77 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 14 Feb 2023 00:32:05 +0000 Subject: [PATCH] Select the first flight config by default --- .../file/rasaero/importt/SimulationListHandler.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/net/sf/openrocket/file/rasaero/importt/SimulationListHandler.java b/core/src/net/sf/openrocket/file/rasaero/importt/SimulationListHandler.java index 94f7f3e3b..f91ca0365 100644 --- a/core/src/net/sf/openrocket/file/rasaero/importt/SimulationListHandler.java +++ b/core/src/net/sf/openrocket/file/rasaero/importt/SimulationListHandler.java @@ -119,6 +119,10 @@ public class SimulationListHandler extends AbstractElementHandler { public void endHandler(String element, HashMap attributes, String content, WarningSet warnings) throws SAXException { FlightConfigurationId id = new FlightConfigurationId(); rocket.createFlightConfiguration(id); + // Select if this is the first config + if (rocket.getSelectedConfiguration().getId().equals(FlightConfigurationId.DEFAULT_VALUE_FCID)) { + rocket.setSelectedConfiguration(id); + } // Add motors to the rocket addMotorToStage(0, sustainerEngine, sustainerIgnitionDelay, id, warnings); @@ -171,6 +175,11 @@ public class SimulationListHandler extends AbstractElementHandler { } } + /** + * Returns the furthest back motor mount in the stage. + * @param stage stage number + * @return furthest back motor mount of the stage + */ private MotorMount getMotorMountForStage(int stage) { MotorMount mount = null; for (RocketComponent component : rocket.getStage(stage)) {