Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions MekHQ/resources/mekhq/resources/GUI.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,26 @@ chkNewDayVesselGunnerPoolFill.toolTipText=Automatically fill the Vessel Gunner p
chkNewDayVesselCrewPoolFill.text=Fill Vessel Crew Pool
chkNewDayVesselCrewPoolFill.toolTipText=Automatically fill the Vessel Crew pool immediately upon selecting new day,\
\ and distribute to vessel units.
chkNewDayAstechPoolNoRelease.text=└ Do Not Release Surplus Astechs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really the cleanest way to mark dependent checkboxes?
Just when I thought my opinion of AWT/Swing couldn't get any lower -_-;

chkNewDayAstechPoolNoRelease.toolTipText=When filling the Astech pool on new day, only hire to cover shortfalls. Surplus astechs are not released.
chkNewDayMedicPoolNoRelease.text=└ Do Not Release Surplus Medics
chkNewDayMedicPoolNoRelease.toolTipText=When filling the Medic pool on new day, only hire to cover shortfalls. Surplus medics are not released.
chkNewDaySoldierPoolNoRelease.text=└ Do Not Release Surplus Soldiers
chkNewDaySoldierPoolNoRelease.toolTipText=When filling the Soldier pool on new day, only hire to cover shortfalls. Surplus soldiers are not released.
chkNewDayBattleArmorPoolNoRelease.text=└ Do Not Release Surplus Battle Armor Crew
chkNewDayBattleArmorPoolNoRelease.toolTipText=When filling the Battle Armor pool on new day, only hire to cover shortfalls. Surplus crew are not released.
chkNewDayVehicleCrewGroundPoolNoRelease.text=└ Do Not Release Surplus Vehicle Crew (Ground)
chkNewDayVehicleCrewGroundPoolNoRelease.toolTipText=When filling the Vehicle Crew (Ground) pool on new day, only hire to cover shortfalls. Surplus crew are not released.
chkNewDayVehicleCrewVTOLPoolNoRelease.text=└ Do Not Release Surplus Vehicle Crew (VTOL)
chkNewDayVehicleCrewVTOLPoolNoRelease.toolTipText=When filling the Vehicle Crew (VTOL) pool on new day, only hire to cover shortfalls. Surplus crew are not released.
chkNewDayVehicleCrewNavalPoolNoRelease.text=└ Do Not Release Surplus Vehicle Crew (Naval)
chkNewDayVehicleCrewNavalPoolNoRelease.toolTipText=When filling the Vehicle Crew (Naval) pool on new day, only hire to cover shortfalls. Surplus crew are not released.
chkNewDayVesselPilotPoolNoRelease.text=└ Do Not Release Surplus Vessel Pilots
chkNewDayVesselPilotPoolNoRelease.toolTipText=When filling the Vessel Pilot pool on new day, only hire to cover shortfalls. Surplus pilots are not released.
chkNewDayVesselGunnerPoolNoRelease.text=└ Do Not Release Surplus Vessel Gunners
chkNewDayVesselGunnerPoolNoRelease.toolTipText=When filling the Vessel Gunner pool on new day, only hire to cover shortfalls. Surplus gunners are not released.
chkNewDayVesselCrewPoolNoRelease.text=└ Do Not Release Surplus Vessel Crew
chkNewDayVesselCrewPoolNoRelease.toolTipText=When filling the Vessel Crew pool on new day, only hire to cover shortfalls. Surplus crew are not released.
chkNewDayMRMS.text=Run Mass Repair / Mass Salvage
chkNewDayMRMS.toolTipText=Automatically run Mass Repair and/or Mass Salvage (based on the currently saved options) during new day processing.
chkNewDayOptimizeMedicalAssignments.text=Optimize Medical Assignments
Expand Down
10 changes: 10 additions & 0 deletions MekHQ/src/mekhq/MHQConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@ public final class MHQConstants extends SuiteConstants {
public static final String NEW_DAY_VESSEL_PILOT_POOL_FILL = "newDayVesselPilotPoolFill";
public static final String NEW_DAY_VESSEL_GUNNER_POOL_FILL = "newDayVesselGunnerPoolFill";
public static final String NEW_DAY_VESSEL_CREW_POOL_FILL = "newDayVesselCrewPoolFill";
public static final String NEW_DAY_AS_TECH_POOL_NO_RELEASE = "newDayAstechPoolNoRelease";
public static final String NEW_DAY_MEDIC_POOL_NO_RELEASE = "newDayMedicPoolNoRelease";
public static final String NEW_DAY_SOLDIER_POOL_NO_RELEASE = "newDaySoldierPoolNoRelease";
public static final String NEW_DAY_BATTLE_ARMOR_POOL_NO_RELEASE = "newDayBattleArmorPoolNoRelease";
public static final String NEW_DAY_VEHICLE_CREW_GROUND_POOL_NO_RELEASE = "newDayVehicleCrewGroundPoolNoRelease";
public static final String NEW_DAY_VEHICLE_CREW_VTOL_POOL_NO_RELEASE = "newDayVehicleCrewVTOLPoolNoRelease";
public static final String NEW_DAY_VEHICLE_CREW_NAVAL_POOL_NO_RELEASE = "newDayVehicleCrewNavalPoolNoRelease";
public static final String NEW_DAY_VESSEL_PILOT_POOL_NO_RELEASE = "newDayVesselPilotPoolNoRelease";
public static final String NEW_DAY_VESSEL_GUNNER_POOL_NO_RELEASE = "newDayVesselGunnerPoolNoRelease";
public static final String NEW_DAY_VESSEL_CREW_POOL_NO_RELEASE = "newDayVesselCrewPoolNoRelease";
public static final String NEW_DAY_MRMS = "newDayMRMS";
public static final String NEW_DAY_OPTIMIZE_MEDICAL_ASSIGNMENTS = "NewDayOptimizeMedicalAssignments";
public static final String NEW_DAY_AUTOMATE_MAINTENANCE_ASSIGNMENTS = "NewDayAutomateMaintenanceAssignments";
Expand Down
80 changes: 80 additions & 0 deletions MekHQ/src/mekhq/MHQOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,86 @@ public void setNewDayVesselCrewPoolFill(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_VESSEL_CREW_POOL_FILL, value);
}

public boolean getNewDayAsTechPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_AS_TECH_POOL_NO_RELEASE, false);
}

public void setNewDayAsTechPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_AS_TECH_POOL_NO_RELEASE, value);
}

public boolean getNewDayMedicPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_MEDIC_POOL_NO_RELEASE, false);
}

public void setNewDayMedicPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_MEDIC_POOL_NO_RELEASE, value);
}

public boolean getNewDaySoldierPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_SOLDIER_POOL_NO_RELEASE, false);
}

public void setNewDaySoldierPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_SOLDIER_POOL_NO_RELEASE, value);
}

public boolean getNewDayBattleArmorPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_BATTLE_ARMOR_POOL_NO_RELEASE, false);
}

public void setNewDayBattleArmorPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_BATTLE_ARMOR_POOL_NO_RELEASE, value);
}

public boolean getNewDayVehicleCrewGroundPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_VEHICLE_CREW_GROUND_POOL_NO_RELEASE, false);
}

public void setNewDayVehicleCrewGroundPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_VEHICLE_CREW_GROUND_POOL_NO_RELEASE, value);
}

public boolean getNewDayVehicleCrewVTOLPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_VEHICLE_CREW_VTOL_POOL_NO_RELEASE, false);
}

public void setNewDayVehicleCrewVTOLPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_VEHICLE_CREW_VTOL_POOL_NO_RELEASE, value);
}

public boolean getNewDayVehicleCrewNavalPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_VEHICLE_CREW_NAVAL_POOL_NO_RELEASE, false);
}

public void setNewDayVehicleCrewNavalPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_VEHICLE_CREW_NAVAL_POOL_NO_RELEASE, value);
}

public boolean getNewDayVesselPilotPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_VESSEL_PILOT_POOL_NO_RELEASE, false);
}

public void setNewDayVesselPilotPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_VESSEL_PILOT_POOL_NO_RELEASE, value);
}

public boolean getNewDayVesselGunnerPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_VESSEL_GUNNER_POOL_NO_RELEASE, false);
}

public void setNewDayVesselGunnerPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_VESSEL_GUNNER_POOL_NO_RELEASE, value);
}

public boolean getNewDayVesselCrewPoolNoRelease() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_VESSEL_CREW_POOL_NO_RELEASE, false);
}

public void setNewDayVesselCrewPoolNoRelease(final boolean value) {
userPreferences.node(MHQConstants.NEW_DAY_NODE).putBoolean(MHQConstants.NEW_DAY_VESSEL_CREW_POOL_NO_RELEASE, value);
}

public boolean getNewDayMRMS() {
return userPreferences.node(MHQConstants.NEW_DAY_NODE).getBoolean(MHQConstants.NEW_DAY_MRMS, false);
}
Expand Down
77 changes: 56 additions & 21 deletions MekHQ/src/mekhq/campaign/CampaignNewDayManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import megamek.codeUtilities.StringUtility;
import megamek.common.options.OptionsConstants;
import megamek.logging.MMLogger;
import mekhq.MHQOptions;
import mekhq.MekHQ;
import mekhq.campaign.Campaign.AdministratorSpecialization;
import mekhq.campaign.campaignOptions.CampaignOptions;
Expand Down Expand Up @@ -249,52 +250,86 @@ public boolean newDay() {
// clear previous retirement information
campaign.getTurnoverRetirementInformation().clear();

// Refill Automated Pools, if the options are selected
if (MekHQ.getMHQOptions().getNewDayAsTechPoolFill()) {
campaign.resetAsTechPool();
// Refill Automated Pools, if the options are selected.
// When "no release" is also set, only hire to cover shortfalls (skip firing surplus).
final MHQOptions mhqOptions = MekHQ.getMHQOptions();
if (mhqOptions.getNewDayAsTechPoolFill()) {
if (mhqOptions.getNewDayAsTechPoolNoRelease()) {
campaign.fillAsTechPool();
} else {
campaign.resetAsTechPool();
}
}

if (MekHQ.getMHQOptions().getNewDayMedicPoolFill()) {
campaign.resetMedicPool();
if (mhqOptions.getNewDayMedicPoolFill()) {
if (mhqOptions.getNewDayMedicPoolNoRelease()) {
campaign.fillMedicPool();
} else {
campaign.resetMedicPool();
}
}

if (MekHQ.getMHQOptions().getNewDaySoldierPoolFill()) {
campaign.resetTempCrewPoolForRole(PersonnelRole.SOLDIER);
if (mhqOptions.getNewDaySoldierPoolFill()) {
if (!mhqOptions.getNewDaySoldierPoolNoRelease()) {
campaign.emptyTempCrewPoolForRole(PersonnelRole.SOLDIER);
}
campaign.fillTempCrewPoolForRole(PersonnelRole.SOLDIER);
campaign.distributeTempCrewPoolToUnits(PersonnelRole.SOLDIER);
}

if (MekHQ.getMHQOptions().getNewDayBattleArmorPoolFill()) {
campaign.resetTempCrewPoolForRole(PersonnelRole.BATTLE_ARMOUR);
if (mhqOptions.getNewDayBattleArmorPoolFill()) {
if (!mhqOptions.getNewDayBattleArmorPoolNoRelease()) {
campaign.emptyTempCrewPoolForRole(PersonnelRole.BATTLE_ARMOUR);
}
campaign.fillTempCrewPoolForRole(PersonnelRole.BATTLE_ARMOUR);
campaign.distributeTempCrewPoolToUnits(PersonnelRole.BATTLE_ARMOUR);
}

if (MekHQ.getMHQOptions().getNewDayVehicleCrewGroundPoolFill()) {
campaign.resetTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_GROUND);
if (mhqOptions.getNewDayVehicleCrewGroundPoolFill()) {
if (!mhqOptions.getNewDayVehicleCrewGroundPoolNoRelease()) {
campaign.emptyTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_GROUND);
}
campaign.fillTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_GROUND);
campaign.distributeTempCrewPoolToUnits(PersonnelRole.VEHICLE_CREW_GROUND);
}

if (MekHQ.getMHQOptions().getNewDayVehicleCrewVTOLPoolFill()) {
campaign.resetTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_VTOL);
if (mhqOptions.getNewDayVehicleCrewVTOLPoolFill()) {
if (!mhqOptions.getNewDayVehicleCrewVTOLPoolNoRelease()) {
campaign.emptyTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_VTOL);
}
campaign.fillTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_VTOL);
campaign.distributeTempCrewPoolToUnits(PersonnelRole.VEHICLE_CREW_VTOL);
}

if (MekHQ.getMHQOptions().getNewDayVehicleCrewNavalPoolFill()) {
campaign.resetTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_NAVAL);
if (mhqOptions.getNewDayVehicleCrewNavalPoolFill()) {
if (!mhqOptions.getNewDayVehicleCrewNavalPoolNoRelease()) {
campaign.emptyTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_NAVAL);
}
campaign.fillTempCrewPoolForRole(PersonnelRole.VEHICLE_CREW_NAVAL);
campaign.distributeTempCrewPoolToUnits(PersonnelRole.VEHICLE_CREW_NAVAL);
}

if (MekHQ.getMHQOptions().getNewDayVesselPilotPoolFill()) {
campaign.resetTempCrewPoolForRole(PersonnelRole.VESSEL_PILOT);
if (mhqOptions.getNewDayVesselPilotPoolFill()) {
if (!mhqOptions.getNewDayVesselPilotPoolNoRelease()) {
campaign.emptyTempCrewPoolForRole(PersonnelRole.VESSEL_PILOT);
}
campaign.fillTempCrewPoolForRole(PersonnelRole.VESSEL_PILOT);
campaign.distributeTempCrewPoolToUnits(PersonnelRole.VESSEL_PILOT);
}

if (MekHQ.getMHQOptions().getNewDayVesselGunnerPoolFill()) {
campaign.resetTempCrewPoolForRole(PersonnelRole.VESSEL_GUNNER);
if (mhqOptions.getNewDayVesselGunnerPoolFill()) {
if (!mhqOptions.getNewDayVesselGunnerPoolNoRelease()) {
campaign.emptyTempCrewPoolForRole(PersonnelRole.VESSEL_GUNNER);
}
campaign.fillTempCrewPoolForRole(PersonnelRole.VESSEL_GUNNER);
campaign.distributeTempCrewPoolToUnits(PersonnelRole.VESSEL_GUNNER);
}

if (MekHQ.getMHQOptions().getNewDayVesselCrewPoolFill()) {
campaign.resetTempCrewPoolForRole(PersonnelRole.VESSEL_CREW);
if (mhqOptions.getNewDayVesselCrewPoolFill()) {
if (!mhqOptions.getNewDayVesselCrewPoolNoRelease()) {
campaign.emptyTempCrewPoolForRole(PersonnelRole.VESSEL_CREW);
}
campaign.fillTempCrewPoolForRole(PersonnelRole.VESSEL_CREW);
campaign.distributeTempCrewPoolToUnits(PersonnelRole.VESSEL_CREW);
}

Expand Down
Loading