Skip to content

Commit

Permalink
refactor: Use stream composition for NC3 firing solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
Saklad5 committed Aug 18, 2024
1 parent 2db8795 commit 6bdda62
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions megamek/src/megamek/common/actions/WeaponAttackAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -1276,13 +1276,9 @@ private static String toHitIsImpossible(Game game, Entity ae, int attackerId, Ta
&& ae.isSpaceborne()) {
boolean networkFiringSolution = false;
//Check to see if the attacker has a firing solution. Naval C3 networks share targeting data
if (ae.hasNavalC3()) {
for (Entity en : game.getC3NetworkMembers(ae)) {
if (te != null && en.hasFiringSolutionFor(te.getId())) {
networkFiringSolution = true;
break;
}
}
if (ae.hasNavalC3() && te != null
&& game.getC3NetworkMembers(ae).stream().anyMatch(en -> en.hasFiringSolutionFor(te.getId())) {
networkFiringSolution = true;
}
if (!networkFiringSolution) {
//If we don't check for target type here, we can't fire screens and missiles at hexes...
Expand Down

0 comments on commit 6bdda62

Please sign in to comment.