diff --git a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java index 72fdacac1..757e11a49 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java +++ b/core/src/net/sf/openrocket/rocketcomponent/FlightConfiguration.java @@ -46,22 +46,23 @@ public class FlightConfiguration implements FlightConfigurableParameter stages = new HashMap(); // Map of stage number to StageFlags of the corresponding stage + final protected Map stages = new HashMap<>(); // Map of stage number to StageFlags of the corresponding stage final protected Map motors = new HashMap(); final private Collection activeMotors = new ConcurrentLinkedQueue(); final private InstanceMap activeInstances = new InstanceMap(); @@ -130,7 +131,7 @@ public class FlightConfiguration implements FlightConfigurableParameter getAllStages() { List stages = new ArrayList<>(); for (StageFlags flags : this.stages.values()) { - stages.add( rocket.getStage(flags.stageNumber)); + stages.add( rocket.getStage(flags.stageId)); } return stages; } @@ -380,7 +381,7 @@ public class FlightConfiguration implements FlightConfigurableParameter stagesBackup = new HashMap<>(this.stages); this.stages.clear(); for (AxialStage curStage : this.rocket.getStageList()) { if (curStage == null) continue; - StageFlags flagsToAdd = new StageFlags( curStage.getStageNumber(), true); + boolean active = true; + for (FlightConfiguration.StageFlags flag : stagesBackup.values()) { + if (flag.stageId.equals(curStage.getStageId())) { + active = flag.active; + break; + } + } + StageFlags flagsToAdd = new StageFlags(curStage.getStageNumber(), curStage.getStageId(), active); this.stages.put(curStage.getStageNumber(), flagsToAdd); } } @@ -850,8 +855,8 @@ public class FlightConfiguration implements FlightConfigurableParameter