diff --git a/game-app/game-core/src/main/java/games/strategy/triplea/attachments/UnitAttachment.java b/game-app/game-core/src/main/java/games/strategy/triplea/attachments/UnitAttachment.java index d091731cf22..1d95388c04f 100644 --- a/game-app/game-core/src/main/java/games/strategy/triplea/attachments/UnitAttachment.java +++ b/game-app/game-core/src/main/java/games/strategy/triplea/attachments/UnitAttachment.java @@ -2516,7 +2516,12 @@ private Tuple parseStackingLimit(final String type, final Strin return Tuple.of(max, s[1].intern()); } - private void setTuv(final String s) { + private void setTuv(final String s) throws GameParseException { + final int value = getInt(s); + if (value < -1) { + throw new GameParseException( + "tuv must be 0 positive (or -1, default, to calculate) " + thisErrorMsg()); + } tuv = getInt(s); } diff --git a/game-app/game-core/src/main/java/games/strategy/triplea/util/TuvCostsCalculator.java b/game-app/game-core/src/main/java/games/strategy/triplea/util/TuvCostsCalculator.java index cbaab966851..dd5c4468d01 100644 --- a/game-app/game-core/src/main/java/games/strategy/triplea/util/TuvCostsCalculator.java +++ b/game-app/game-core/src/main/java/games/strategy/triplea/util/TuvCostsCalculator.java @@ -120,7 +120,7 @@ private static IntegerMap getCostsForTuvForAllPlayersMergedAndAveraged // Add any units that have XML TUV even if they aren't purchasable for (final UnitType unitType : data.getUnitTypeList()) { final UnitAttachment ua = unitType.getUnitAttachment(); - if (ua.getTuv() > 0) { + if (ua.getTuv() > -1) { costs.put(unitType, ua.getTuv()); } } @@ -131,7 +131,7 @@ private static IntegerMap getCostsForTuvForAllPlayersMergedAndAveraged private static int getTotalTuv( final UnitType unitType, final IntegerMap costs, final Set alreadyAdded) { final UnitAttachment ua = unitType.getUnitAttachment(); - if (ua.getTuv() > 0) { + if (ua.getTuv() > -1) { return ua.getTuv(); } int tuv = costs.getInt(unitType);