[#1848] Parse all stages (including boosters) for top stage

This commit is contained in:
SiboVG 2022-11-24 19:25:07 +01:00
parent f723508491
commit 6bc74f6b91

View File

@ -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
* @return the topmost active stage, or null if there are no active stages.
*/
public AxialStage getTopmostStage(FlightConfiguration config) {
if (config == null) return null;
for (int i = 0; i < getChildCount(); i++) {
if (getChild(i) instanceof AxialStage && config.isStageActive(getChild(i).getStageNumber())) {
return (AxialStage) getChild(i);
for (AxialStage stage : getStageList()) {
if (config.isStageActive(stage.getStageNumber())) {
return stage;
}
}
return null;