Skip to content

Commit

Permalink
Merge pull request #5307 from IllianiCBT/autoAwards_theatreOfWarBug
Browse files Browse the repository at this point in the history
Fixed Theatre of War Faction Checks
  • Loading branch information
IllianiCBT authored Dec 12, 2024
2 parents f17a228 + be8f60f commit f4aecc8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ public static Map<Integer, List<Object>> TheatreOfWarAwardsProcessor(Campaign ca
boolean isEligible;
List<Award> eligibleAwards = new ArrayList<>();

String employer = ((Contract) mission).getEmployer();
// if the mission isn't an instance of 'AtBContract' we won't have the information we need,
// so abort processing.
if (!(mission instanceof AtBContract)) {
return AutoAwardsController.prepareAwardData(person, eligibleAwards);
}

String employer = ((AtBContract) mission).getEmployerCode();

int contractStartYear = ((Contract) mission).getStartDate().getYear();
int currentYear = campaign.getGameYear();
Expand Down Expand Up @@ -103,10 +109,10 @@ public static Map<Integer, List<Object>> TheatreOfWarAwardsProcessor(Campaign ca
}

if (belligerents.size() == 1) {
if (!processFaction(belligerents.get(0), employer)) {
if (!processFaction(employer, belligerents.get(0))) {
continue;
}
} else if ((campaign.getCampaignOptions().isUseAtB()) && (mission instanceof AtBContract)) {
} else if (campaign.getCampaignOptions().isUseAtB()) {
String enemy = ((AtBContract) mission).getEnemyCode();

if (hasLoyalty(employer, attackers)) {
Expand Down
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private void initComponents() {
AutoAwardsTableModel model = new AutoAwardsTableModel(campaign);
// This is where we insert the external data
logger.info("Trying to pass data to AutoAwardsTableModel.java");
logger.info("Data being passed: {}", data);
logger.debug("Data being passed: {}", data);
model.setData(data);
logger.info("Attempt successful");
personnelTable = new AutoAwardsTable(model);
Expand Down
4 changes: 2 additions & 2 deletions MekHQ/src/mekhq/gui/model/AutoAwardsTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public void setData(Map<Integer, List<Object>> map) {
if (map.isEmpty()) {
logger.error("AutoAwardsDialog failed to pass 'data' into AutoAwardsTableModel");
} else {
logger.info("AutoAwardsDialog passed 'data' into AutoAwardsTableModel: {}", map);
logger.debug("AutoAwardsDialog passed 'data' into AutoAwardsTableModel: {}", map);
}

data = map;
logger.info("Translated data: {}", data);
logger.debug("Translated data: {}", data);
}

@Override
Expand Down

0 comments on commit f4aecc8

Please sign in to comment.