[#1848] Parse all stages (including boosters) for top stage
This commit is contained in:
parent
f723508491
commit
6bc74f6b91
@ -209,16 +209,16 @@ public class Rocket extends ComponentAssembly {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the topmost stage, only taking into account active stages from the flight configuration.
|
* Get the topmost stage (including boosters), only taking into account active stages from the flight configuration.
|
||||||
* @param config flight configuration dictating which stages are active
|
* @param config flight configuration dictating which stages are active
|
||||||
* @return the topmost active stage, or null if there are no active stages.
|
* @return the topmost active stage, or null if there are no active stages.
|
||||||
*/
|
*/
|
||||||
public AxialStage getTopmostStage(FlightConfiguration config) {
|
public AxialStage getTopmostStage(FlightConfiguration config) {
|
||||||
if (config == null) return null;
|
if (config == null) return null;
|
||||||
|
|
||||||
for (int i = 0; i < getChildCount(); i++) {
|
for (AxialStage stage : getStageList()) {
|
||||||
if (getChild(i) instanceof AxialStage && config.isStageActive(getChild(i).getStageNumber())) {
|
if (config.isStageActive(stage.getStageNumber())) {
|
||||||
return (AxialStage) getChild(i);
|
return stage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user