Skip to content

Commit

Permalink
Merge pull request #4275 from IllianiCBT/turnover_originaUnitPayoutBug
Browse files Browse the repository at this point in the history
Fixed Original Unit Value Being Deducted from Payout Sum When Personnel Resign/Retire
  • Loading branch information
IllianiCBT authored Jun 23, 2024
2 parents f76d2f2 + 1d7188e commit 705635c
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions MekHQ/src/mekhq/gui/dialog/RetirementDefectionDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -636,25 +636,10 @@ public Money totalPayout() {
/* If no unit is required as part of the payout, the unit is part or all of the
* final payout.
*/
if ((rdTracker.getPayout(id).getWeightClass() == 0 &&
null != unitAssignments.get(id) &&
null != hqView.getCampaign().getUnit(unitAssignments.get(id)))) {
payout = payout.minus(hqView.getCampaign().getUnit(unitAssignments.get(id)).getBuyCost());
} else if ((hqView.getCampaign().getCampaignOptions().isUseShareSystem()
&& hqView.getCampaign().getCampaignOptions().isTrackOriginalUnit()
&& Objects.equals(hqView.getCampaign().getPerson(id).getOriginalUnitId(), unitAssignments.get(id)))
&& hqView.getCampaign().getUnit(unitAssignments.get(id)) != null) {
payout = payout.minus(hqView.getCampaign().getUnit(unitAssignments.get(id)).getBuyCost());
}

/* If using the share system and tracking the original unit,
* the payout is also reduced by the value of the unit.
*/
if (hqView.getCampaign().getCampaignOptions().isUseShareSystem()
&& hqView.getCampaign().getCampaignOptions().isTrackOriginalUnit()
&& Objects.equals(hqView.getCampaign().getPerson(id).getOriginalUnitId(), unitAssignments.get(id))
&& hqView.getCampaign().getUnit(unitAssignments.get(id)) != null) {
payout = payout.minus(hqView.getCampaign().getUnit(unitAssignments.get(id)).getBuyCost());
if ((rdTracker.getPayout(id).getWeightClass() == 0)
&& (unitAssignments.get(id) != null)
&& (hqView.getCampaign().getUnit(unitAssignments.get(id)) != null)) {
payout = payout.minus(hqView.getCampaign().getUnit(unitAssignments.get(id)).getSellValue());
}

// If the person is still under contract, we don't care that they're owed a unit
Expand Down

0 comments on commit 705635c

Please sign in to comment.