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