Skip to content

Commit

Permalink
refactor: Avoid unnecessary iteration when checking linked components of
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Saklad5 committed Aug 18, 2024
1 parent e3ead6d commit d7d9074
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion megamek/src/megamek/common/actions/WeaponAttackAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d7d9074

Please sign in to comment.