Skip to content

Commit

Permalink
Merge pull request #4816 from SuperStucco/Fix-4535
Browse files Browse the repository at this point in the history
Improved limits on generating infantry for APCs
  • Loading branch information
IllianiCBT authored Sep 13, 2024
2 parents 34f0e11 + 6cc4a92 commit d912f0a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions MekHQ/src/mekhq/campaign/mission/AtBDynamicScenarioFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -1654,11 +1654,9 @@ private static List<Entity> fillTransport(AtBScenario scenario,
// If unit has an infantry bay
if (bay instanceof TroopSpace) {

boolean isLargeBay = bay.getUnused() >= 6.0;

boolean keepLoading = true;
while (keepLoading) {
double bayCapacity = bay.getUnused();
double bayCapacity = bay.getUnused();
int remainingCount = (int) Math.max(1, Math.floor(bayCapacity / IUnitGenerator.FOOT_PLATOON_INFANTRY_WEIGHT));
while (remainingCount > 0) {

// Set base random generation parameters
UnitGeneratorParameters newParams = params.clone();
Expand Down Expand Up @@ -1715,9 +1713,12 @@ private static List<Entity> fillTransport(AtBScenario scenario,
}

transportedUnits.add(transportedUnit);
remainingCount--;
bayCapacity -= transportedUnit.getWeight();
if (bayCapacity < IUnitGenerator.FOOT_PLATOON_INFANTRY_WEIGHT) {
remainingCount = 0;
}

keepLoading = isLargeBay && bayCapacity >= IUnitGenerator.FOOT_PLATOON_INFANTRY_WEIGHT;
}

}
Expand Down

0 comments on commit d912f0a

Please sign in to comment.