Skip to content

Commit

Permalink
Merge pull request #5701 from IllianiCBT/weightClassIssue
Browse files Browse the repository at this point in the history
Corrected Weight Class Initialization of Artillery Units
  • Loading branch information
Sleet01 authored Jan 9, 2025
2 parents 57575af + 4ba3832 commit a3e9d09
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import static mekhq.campaign.mission.ScenarioForceTemplate.SPECIAL_UNIT_TYPE_ATB_AERO_MIX;
import static mekhq.campaign.mission.ScenarioForceTemplate.SPECIAL_UNIT_TYPE_ATB_CIVILIANS;
import static mekhq.campaign.mission.ScenarioForceTemplate.SPECIAL_UNIT_TYPE_ATB_MIX;
import static mekhq.campaign.universe.IUnitGenerator.unitTypeSupportsWeightClass;

/**
* This class handles the creation and substantive manipulation of
Expand Down Expand Up @@ -671,10 +672,10 @@ public static int generateForce(AtBDynamicScenario scenario, AtBContract contrac
// Formations composed entirely of Meks, aerospace fighters (but not conventional),
// and ground vehicles use weight categories as do SPECIAL_UNIT_TYPE_ATB_MIX.
// Formations of other types, plus artillery formations do not use weight classes.
boolean supportsWeightClass = unitTypeSupportsWeightClass(actualUnitType);
if ((actualUnitType == SPECIAL_UNIT_TYPE_ATB_MIX
|| actualUnitType == SPECIAL_UNIT_TYPE_ATB_CIVILIANS
|| IUnitGenerator.unitTypeSupportsWeightClass(actualUnitType))
&& !forceTemplate.getUseArtillery()) {
|| supportsWeightClass)) {

// Generate a specific weight class for each unit based on the formation weight
// class and lower/upper bounds
Expand Down Expand Up @@ -1841,7 +1842,7 @@ public static Entity getTankEntity(UnitGeneratorParameters params,
if (unitData == null) {
if (!params.getMissionRoles().isEmpty()) {
logger.warn(String.format("Unable to randomly generate %s %s with roles: %s",
EntityWeightClass.getClassName(params.getWeightClass()),
params.getWeightClass(),
getTypeName(TANK),
params.getMissionRoles().stream().map(Enum::name).collect(Collectors.joining(","))));
}
Expand Down

0 comments on commit a3e9d09

Please sign in to comment.