diff --git a/megamek/src/megamek/client/ui/swing/boardview/EntitySprite.java b/megamek/src/megamek/client/ui/swing/boardview/EntitySprite.java index 15efe956f2c..54fb4876cff 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/EntitySprite.java +++ b/megamek/src/megamek/client/ui/swing/boardview/EntitySprite.java @@ -621,7 +621,7 @@ public void prepare() { stStr.add(new Status(GUIP.getCautionColor(), "ROLLED")); } - if ((a.getCurrentFuel() <= 0) && entity.hasEngine() && !entity.getEngine().isSolar()) { + if ((a.getCurrentFuel() <= 0) && a.requiresFuel()) { stStr.add(new Status(GUIP.getWarningColor(), "FUEL")); } diff --git a/megamek/src/megamek/common/ConvFighter.java b/megamek/src/megamek/common/ConvFighter.java index 3a570d8a91d..a316d65c71b 100644 --- a/megamek/src/megamek/common/ConvFighter.java +++ b/megamek/src/megamek/common/ConvFighter.java @@ -66,7 +66,7 @@ public double getFuelPointsPerTon() { @Override public int getFuelUsed(int thrust) { - if (!hasEngine() || getEngine().isSolar()) { + if (!hasEngine() || !requiresFuel()) { return 0; } int overThrust = Math.max(thrust - getWalkMP(), 0); diff --git a/megamek/src/megamek/common/FixedWingSupport.java b/megamek/src/megamek/common/FixedWingSupport.java index 764d4ce9a09..21968f7a362 100644 --- a/megamek/src/megamek/common/FixedWingSupport.java +++ b/megamek/src/megamek/common/FixedWingSupport.java @@ -161,9 +161,9 @@ public double getFuelPointsPerTon() { @Override public boolean requiresFuel() { - return !(((hasPropChassisMod() || getMovementMode().isAirship())) - && hasEngine() && (getEngine().isFusion() || (getEngine().getEngineType() == Engine.FISSION) - || (getEngine().getEngineType() == Engine.SOLAR))); + return !((hasPropChassisMod() || getMovementMode().isAirship()) + && hasEngine() + && (getEngine().isFusion() || getEngine().isFission() || getEngine().isSolar())); } private static final TechAdvancement TA_FIXED_WING_SUPPORT = new TechAdvancement(TECH_BASE_ALL) diff --git a/megamek/src/megamek/common/IAero.java b/megamek/src/megamek/common/IAero.java index 6c902f85af4..69867e91019 100644 --- a/megamek/src/megamek/common/IAero.java +++ b/megamek/src/megamek/common/IAero.java @@ -146,6 +146,13 @@ default int getClusterMods() { double getFuelPointsPerTon(); + /** + * @return True when this aero requires fuel to move. Note that the result is undefined when + * the unit has no engine. Callers should consider this case themselves. Also note that + * this method does not check whether fuel use as a game option is active, only if the unit + * technically requires fuel to move. For example, returns false for solar powered prop-driven + * fixed wing support (TM p129). + */ default boolean requiresFuel() { return true; } @@ -776,7 +783,7 @@ default void land() { default int getFuelUsed(int thrust) { Entity entity = (Entity) this; - if (entity.hasEngine() && entity.getEngine().isSolar()) { + if (!entity.hasEngine() || !requiresFuel()) { return 0; } else { int overThrust = Math.max(thrust - entity.getWalkMP(), 0); diff --git a/megamek/src/megamek/common/MoveStep.java b/megamek/src/megamek/common/MoveStep.java index 04737c1e1e3..71881773e38 100644 --- a/megamek/src/megamek/common/MoveStep.java +++ b/megamek/src/megamek/common/MoveStep.java @@ -1921,7 +1921,7 @@ private void compileIllegal(final Game game, final Entity entity, // check the fuel requirements if (game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_FUEL_CONSUMPTION) - && entity.hasEngine() && !entity.getEngine().isSolar()) { + && entity.hasEngine() && a.requiresFuel()) { int fuelUsed = mpUsed + Math.max(mpUsed - cachedEntityState.getWalkMP(), 0); if (fuelUsed > a.getCurrentFuel()) { return;