From 416c88432d5537e82feafb4de415da0d195b1df3 Mon Sep 17 00:00:00 2001 From: sleet01 Date: Mon, 18 Sep 2023 23:56:37 -0700 Subject: [PATCH] Two EnumSets can be compared with .equals(), who knew? --- megameklab/src/megameklab/util/UnitUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megameklab/src/megameklab/util/UnitUtil.java b/megameklab/src/megameklab/util/UnitUtil.java index f7722f2e0..2e4d738ed 100644 --- a/megameklab/src/megameklab/util/UnitUtil.java +++ b/megameklab/src/megameklab/util/UnitUtil.java @@ -3788,7 +3788,7 @@ public static void replaceFieldGun(Infantry unit, WeaponType fieldGun, int num) munition = EnumSet.of(AmmoType.Munitions.M_STANDARD); } Optional ammo = AmmoType.getMunitionsFor(fieldGun.getAmmoType()).stream() - .filter(eq -> (eq.getMunitionType().contains(munition)) + .filter(eq -> (eq.getMunitionType().equals(munition)) && (eq.getRackSize() == fieldGun.getRackSize())) .findFirst(); if (ammo.isEmpty()) {