Skip to content

Commit

Permalink
Merge pull request #6218 from psikomonkie/issue-6217-too-many-gunners…
Browse files Browse the repository at this point in the history
…-for-aerospace-in-mekhq

Issue 6217 - Too many gunners for aerospace in MekHQ - Unified Aerosp…
  • Loading branch information
HammerGS authored Nov 29, 2024
2 parents 9afd4fe + e737395 commit ca61916
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
5 changes: 5 additions & 0 deletions megamek/src/megamek/common/Compute.java
Original file line number Diff line number Diff line change
Expand Up @@ -7294,6 +7294,11 @@ public static int getTotalGunnerNeeds(Entity entity) {
continue;
}
if (type instanceof WeaponType) {
if ((((WeaponType) m.getType()).getLongRange() <= 1)
// MML range depends on ammo, and getLongRange() returns 0
&& (((WeaponType) m.getType()).getAmmoType() != AmmoType.T_MML)) {
continue;
}
if (((WeaponType) type).isCapital()) {
nCapitalW++;
} else {
Expand Down
23 changes: 1 addition & 22 deletions megamek/src/megamek/common/verifier/TestAero.java
Original file line number Diff line number Diff line change
Expand Up @@ -1240,28 +1240,7 @@ public static int minimumBaseCrew(Aero aero) {
* @return The vessel's minimum gunner requirements.
*/
public static int requiredGunners(Aero aero) {
if (!aero.isLargeCraft() && !aero.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) {
return 0;
}
int capitalWeapons = 0;
int stdWeapons = 0;
for (Mounted<?> m : aero.getTotalWeaponList()) {
if (m.getType() instanceof BayWeapon) {
continue;
}
if ((((WeaponType) m.getType()).getLongRange() <= 1)
// MML range depends on ammo, and getLongRange() returns 0
&& (((WeaponType) m.getType()).getAmmoType() != AmmoType.T_MML)) {
continue;
}
if (((WeaponType) m.getType()).isCapital()
|| (m.getType() instanceof ScreenLauncherWeapon)) {
capitalWeapons++;
} else {
stdWeapons++;
}
}
return capitalWeapons + (int) Math.ceil(stdWeapons / 6.0);
return Compute.getTotalGunnerNeeds(aero);
}

/**
Expand Down

0 comments on commit ca61916

Please sign in to comment.