From fd5dc0eadfc2d27162d2f57bdf18230b56ac4f1a Mon Sep 17 00:00:00 2001 From: Jeremy Saklad Date: Sun, 18 Aug 2024 12:52:24 -0500 Subject: [PATCH] refactor: Avoid unnecessary iteration when checking linked components of bay weapons This leaves a lot of copy-pasted code in place, but untangling that is proving to be a bit of a headache, so this will suffice for the moment. --- megamek/src/megamek/common/actions/WeaponAttackAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megamek/src/megamek/common/actions/WeaponAttackAction.java b/megamek/src/megamek/common/actions/WeaponAttackAction.java index 19a137259b1..9c2b018596f 100644 --- a/megamek/src/megamek/common/actions/WeaponAttackAction.java +++ b/megamek/src/megamek/common/actions/WeaponAttackAction.java @@ -468,7 +468,7 @@ private static ToHitData toHitCalc(Game game, int attackerId, Targetable target, && (munition.contains(AmmoType.Munitions.M_ARTEMIS_V_CAPABLE))); if (ae.usesWeaponBays()) { - for (WeaponMounted bayW : weapon.getBayWeapons()) { + for (WeaponMounted bayW : weapon.streamBayWeapons()) { Mounted bayWAmmo = bayW.getLinked(); if (bayWAmmo == null) {