Skip to content

Commit 9908f7d

Browse files
committed
Merge remote-tracking branch 'origin/bayRentalFix' into bayRentalFix
2 parents 44626d8 + 39f7eac commit 9908f7d

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

MekHQ/src/mekhq/campaign/mission/rentals/FacilityRentals.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,18 +460,32 @@ private static boolean performRentalTransaction(Finances finances, LocalDate tod
460460
getFormattedTextAt(RESOURCE_BUNDLE, "FacilityRentals.rental." + rentalType, rentalCost.toAmountString()));
461461
}
462462

463+
/**
464+
* Processes a request to change bay assignments for the specified units, offering bay rental opportunities
465+
* if allowed by the current campaign state.
466+
* <p>
467+
* Bay rentals are only permitted if the campaign is either off-contract or on a garrison-type contract,
468+
* and the campaign's location is planetside. If these conditions are not met, a dialog is shown to the user
469+
* indicating that no facilities are available.
470+
* </p>
471+
*
472+
* @param campaign the current campaign context
473+
* @param selectedUnits the units for which bay changes are requested
474+
* @param bayType the type of bay being requested (e.g., {@link Unit#SITE_FACILITY_MAINTENANCE}, {@link Unit#SITE_FACTORY_CONDITIONS})
475+
* @return {@code true} if the bay change process can proceed; {@code false} if not allowed (e.g., due to contract or location restrictions)
476+
*/
463477
public static boolean processBayChangeRequest(Campaign campaign, Unit[] selectedUnits, int bayType) {
464478
List<AtBContract> activeAtBContracts = campaign.getActiveAtBContracts();
465-
boolean isOffContractOrOnGarrison = activeAtBContracts.isEmpty();
479+
boolean isBayRentalAllowed = activeAtBContracts.isEmpty();
466480

467481
for (AtBContract atBContract : activeAtBContracts) {
468482
if (atBContract.getContractType().isGarrisonType()) {
469-
isOffContractOrOnGarrison = true;
483+
isBayRentalAllowed = true;
470484
break;
471485
}
472486
}
473487

474-
if (!isOffContractOrOnGarrison || !campaign.getLocation().isOnPlanet()) {
488+
if (!isBayRentalAllowed || !campaign.getLocation().isOnPlanet()) {
475489
BayRentalDialog.showNoFacilitiesAvailableDialog(campaign);
476490
return false;
477491
}

0 commit comments

Comments
 (0)