Fix issue in stage updating for sub-stages

updateStageNumbers would only update direct child stages of the rocket, instead of also ParallelStages
This commit is contained in:
SiboVG 2022-09-24 20:49:23 +02:00
parent 3751b9cd8c
commit b96087e488

View File

@ -546,21 +546,17 @@ public class Rocket extends ComponentAssembly {
* Update all the stage numbers based on their position in the component tree * Update all the stage numbers based on their position in the component tree
*/ */
private void updateStageNumbers() { private void updateStageNumbers() {
for (RocketComponent component : getChildren()) { int stageNr = 0;
if (component instanceof AxialStage) { for (AxialStage stage : getSubStages()) {
AxialStage stage = (AxialStage) component; forgetStage(stage);
forgetStage(stage); stage.setStageNumber(stageNr);
stage.setStageNumber(getChildPosition(stage)); stageNr++;
}
} }
} }
private void updateStageMap(){ private void updateStageMap(){
for( RocketComponent component : getChildren() ){ for (AxialStage stage : getSubStages() ){
if (component instanceof AxialStage) { trackStage(stage);
AxialStage stage = (AxialStage) component;
trackStage(stage);
}
} }
} }