Update stage number upon stage order change in the component tree
This commit is contained in:
parent
b857da940a
commit
c33aa04dd9
@ -496,10 +496,24 @@ public class Rocket extends ComponentAssembly {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(){
|
public void update(){
|
||||||
|
updateStageNumbers();
|
||||||
updateStageMap();
|
updateStageMap();
|
||||||
updateConfigurations();
|
updateConfigurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update all the stage numbers based on their position in the component tree
|
||||||
|
*/
|
||||||
|
private void updateStageNumbers() {
|
||||||
|
for (RocketComponent component : getChildren()) {
|
||||||
|
if (component instanceof AxialStage) {
|
||||||
|
AxialStage stage = (AxialStage) component;
|
||||||
|
forgetStage(stage);
|
||||||
|
stage.setStageNumber(getChildPosition(stage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateStageMap(){
|
private void updateStageMap(){
|
||||||
for( RocketComponent component : getChildren() ){
|
for( RocketComponent component : getChildren() ){
|
||||||
if (component instanceof AxialStage) {
|
if (component instanceof AxialStage) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user