Skip to content

Commit

Permalink
Improve variable name and wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
asvitkine committed Jul 27, 2023
1 parent 50a814d commit 0c98eb2
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2581,9 +2581,8 @@ public static Collection<Unit> filterUnitsByStackingLimit(
// correctly handle stacking limits that apply to multiple unit types.
final var unitsAllowedSoFar = new ArrayList<Unit>();
for (final Unit unit : units) {
final UnitType ut = unit.getType();
final Tuple<Integer, String> stackingLimit =
stackingLimitGetter.apply(ut.getUnitAttachment());
UnitType ut = unit.getType();
Tuple<Integer, String> stackingLimit = stackingLimitGetter.apply(ut.getUnitAttachment());
int maxAllowed =
getMaximumNumberOfThisUnitTypeToReachStackingLimit(
ut, t, owner, stackingLimit, playerStackingLimits, unitsAllowedSoFar);
Expand Down Expand Up @@ -2617,11 +2616,11 @@ private static int getMaximumNumberOfThisUnitTypeToReachStackingLimit(
if (!unitTypes.contains(ut)) {
continue;
}
final String type = limit.getSecond();
final String stackingType = limit.getSecond();
Predicate<Unit> stackingMatch = Matches.unitIsOfTypes(unitTypes);
if (type.equals("owned")) {
if (stackingType.equals("owned")) {
stackingMatch = stackingMatch.and(Matches.unitIsOwnedBy(owner));
} else if (type.equals("allied")) {
} else if (stackingType.equals("allied")) {
stackingMatch = stackingMatch.and(Matches.alliedUnit(owner));
}
final int totalInTerritory = CollectionUtils.countMatches(existingUnits, stackingMatch);
Expand Down

0 comments on commit 0c98eb2

Please sign in to comment.