Skip to content

Commit

Permalink
Merge pull request #3822 from jackreichelt/3194-awarding-non-stackabl…
Browse files Browse the repository at this point in the history
…e-medals

#3194 Awarding non-stackable medals to multiple people
  • Loading branch information
HammerGS authored Feb 4, 2024
2 parents 3afc62f + d96e9a5 commit 3aa366f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions MekHQ/src/mekhq/campaign/personnel/PersonAwardController.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,18 @@ public void addAndLogAward(final Campaign campaign, final String setName,
final Award award;
if (hasAward(setName, awardName)) {
award = getAward(setName, awardName);

if (!award.canBeAwarded(person)) {
LogManager.getLogger().info("Award not stackable, returning.");
return;
}
} else {
award = AwardsFactory.getInstance().generateNew(setName, awardName);
if (award == null) {
LogManager.getLogger().error("Cannot award a null award, returning.");
return;
}

awards.add(award);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ protected Optional<JPopupMenu> createPopupMenu() {
Collections.sort(awardsOfSet);

for (Award award : awardsOfSet) {
if (!award.canBeAwarded(selected)) {
if (oneSelected && !award.canBeAwarded(selected)) {
continue;
}

Expand Down

0 comments on commit 3aa366f

Please sign in to comment.