Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected Weight Class Initialization of Artillery Units #5701

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1840,7 +1841,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
Loading