8000 Issue 6700: Fixed Formation-level kill awards by psikomonkie · Pull Request #6702 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue 6700: Fixed Formation-level kill awards #6702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 18, 2025

Conversation

psikomonkie
Copy link
Collaborator
@psikomonkie psikomonkie commented Apr 17, 2025

Fixes #6700

Incorrect check was done before trying to retrieve a value from a map.

if (!visitedForces.contains(currentNode.getId())) {
      if (forceCredits.contains(currentNode.getId())) {
          kills.addAll(killData.get(currentNode.getId()));
      }

We are checking the killData map, so we need to make sure the force is valid key in the killData map not the forceCredits map. This was throwing a caught exception (line 205-206) that was adding only the base formation's kills.

if (!visitedForces.contains(currentNode.getId())) {
      if (killData.containsKey(currentNode.getId())) {
          kills.addAll(killData.get(currentNode.getId()));
      }

@psikomonkie psikomonkie added Bug Awards Severity: Medium Issues described as medium severity as per the new issue form labels Apr 17, 2025
Copy link
codecov bot commented Apr 17, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 11.41%. Comparing base (acc8e07) to head (1005105).
Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
...ekhq/campaign/personnel/autoAwards/KillAwards.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #6702   +/-   ##
=========================================
  Coverage     11.40%   11.41%           
- Complexity     6478     6479    +1     
=========================================
  Files          1095     1095           
  Lines        140791   140793    +2     
  Branches      21808    21808           
=========================================
+ Hits          16062    16065    +3     
+ Misses       123076   123075    -1     
  Partials       1653     1653           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator
@IllianiBird IllianiBird left a comment

Choose a reason for hiding this comment

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

autoAwards was one of my first coding projects, and kill awards in particular are very complicated, so I wouldn't be surprised if there's more stinkers like this hiding in the woodwork.

Great work catching this so quick. :)

@psikomonkie psikomonkie merged commit bed9ed4 into MegaMek:master Apr 18, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awards Bug Severity: Medium Issues described as medium severity as per the new issue form
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Company Kill Awards not awarded
2 participants
0