Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow tuv to be set to 0. #11896

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2516,7 +2516,12 @@ private Tuple<Integer, String> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private static IntegerMap<UnitType> 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());
}
}
Expand All @@ -131,7 +131,7 @@ private static IntegerMap<UnitType> getCostsForTuvForAllPlayersMergedAndAveraged
private static int getTotalTuv(
final UnitType unitType, final IntegerMap<UnitType> costs, final Set<UnitType> alreadyAdded) {
final UnitAttachment ua = unitType.getUnitAttachment();
if (ua.getTuv() > 0) {
if (ua.getTuv() > -1) {
return ua.getTuv();
}
int tuv = costs.getInt(unitType);
Expand Down