Use built-in component ID instead of extra stageID (whoops)
This commit is contained in:
parent
8c7fb6b67f
commit
3751b9cd8c
@ -13,7 +13,6 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC
|
||||
protected FlightConfigurableParameterSet<StageSeparationConfiguration> separations;
|
||||
/** number of stages */
|
||||
protected int stageNumber;
|
||||
private FlightConfigurationId stageId;
|
||||
|
||||
/**
|
||||
* default constructor, builds a rocket with zero stages
|
||||
@ -22,7 +21,6 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC
|
||||
this.separations = new FlightConfigurableParameterSet<StageSeparationConfiguration>( new StageSeparationConfiguration());
|
||||
this.axialMethod = AxialMethod.AFTER;
|
||||
this.stageNumber = 0;
|
||||
this.stageId = new FlightConfigurationId();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,14 +90,9 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC
|
||||
protected RocketComponent copyWithOriginalID() {
|
||||
AxialStage copy = (AxialStage) super.copyWithOriginalID();
|
||||
copy.separations = new FlightConfigurableParameterSet<StageSeparationConfiguration>(separations);
|
||||
copy.stageId = new FlightConfigurationId();
|
||||
return copy;
|
||||
}
|
||||
|
||||
public FlightConfigurationId getStageId() {
|
||||
return stageId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stages may be positioned relative to other stages. In that case, this will set the stage number
|
||||
* against which this stage is positioned.
|
||||
|
@ -47,9 +47,9 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
private class StageFlags implements Cloneable {
|
||||
public boolean active = true;
|
||||
public int stageNumber = -1;
|
||||
public FlightConfigurationId stageId;
|
||||
public String stageId;
|
||||
|
||||
public StageFlags(int _num, FlightConfigurationId stageId, boolean _active) {
|
||||
public StageFlags(int _num, String stageId, boolean _active) {
|
||||
this.stageNumber = _num;
|
||||
this.stageId = stageId;
|
||||
this.active = _active;
|
||||
@ -465,12 +465,12 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
if (curStage == null) continue;
|
||||
boolean active = true;
|
||||
for (FlightConfiguration.StageFlags flag : stagesBackup.values()) {
|
||||
if (flag.stageId.equals(curStage.getStageId())) {
|
||||
if (flag.stageId.equals(curStage.getID())) {
|
||||
active = flag.active;
|
||||
break;
|
||||
}
|
||||
}
|
||||
StageFlags flagsToAdd = new StageFlags(curStage.getStageNumber(), curStage.getStageId(), active);
|
||||
StageFlags flagsToAdd = new StageFlags(curStage.getStageNumber(), curStage.getID(), active);
|
||||
this.stages.put(curStage.getStageNumber(), flagsToAdd);
|
||||
}
|
||||
}
|
||||
@ -855,7 +855,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
final String fmt = " [%-2s][%4s]: %6s \n";
|
||||
buf.append(String.format(fmt, "#", "?actv", "Name"));
|
||||
for (StageFlags flags : stages.values()) {
|
||||
final FlightConfigurationId stageId = flags.stageId;
|
||||
final String stageId = flags.stageId;
|
||||
buf.append(String.format(fmt, stageId, (flags.active?" on": "off"), rocket.getStage(stageId).getName()));
|
||||
}
|
||||
buf.append("\n");
|
||||
|
@ -198,9 +198,9 @@ public class Rocket extends ComponentAssembly {
|
||||
return this.stageMap.get( stageNumber);
|
||||
}
|
||||
|
||||
public AxialStage getStage(final FlightConfigurationId stageId) {
|
||||
public AxialStage getStage(final String stageId) {
|
||||
for (AxialStage stage : getStageList()) {
|
||||
if (stage.getStageId().equals(stageId)) {
|
||||
if (stage.getID().equals(stageId)) {
|
||||
return stage;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user