8000 Fix: #6937 Fixed Display of Implants in New Person View Panel by IllianiBird · Pull Request #6940 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: #6937 Fixed Display of Implants in New Person View Panel #6940

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 2 commits into from
May 10, 2025

Conversation

IllianiBird
Copy link
Collaborator
@IllianiBird IllianiBird commented May 9, 2025

Fix #6937

It turns out implants are not special abilities but they are treated as SPAs. It's a whole thing, but now we correctly account for them in the updated person view.

@IllianiBird IllianiBird self-assigned this May 9, 2025
@IllianiBird IllianiBird requested a review from a team as a code owner May 9, 2025 16:08
@IllianiBird IllianiBird added Bug GUI Severity: High Issues described as high severity as per the new issue form labels May 9, 2025
Copy link
codecov bot commented May 9, 2025

Codecov Report

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

Project coverage is 12.04%. Comparing base (4158360) to head (c601b7d).
Report is 74 commits behind head on master.

Files with missing lines Patch % Lines
MekHQ/src/mekhq/gui/view/PersonViewPanel.java 0.00% 19 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6940      +/-   ##
============================================
- Coverage     12.04%   12.04%   -0.01%     
+ Complexity     6851     6847       -4     
============================================
  Files          1101     1101              
  Lines        141386   141376      -10     
  Branches      21897    21900       +3     
============================================
- Hits          17028    17023       -5     
+ Misses       122537   122529       -8     
- Partials       1821     1824       +3     

☔ 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
@psikomonkie psikomonkie left a comment

Choose a reason for hiding this comment

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

Nice!

@HammerGS HammerGS requested a review from Copilot May 10, 2025 19:16
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes the display issue for implants in the New Person View Panel by correctly treating implants as distinct from special abilities. Key changes include:

  • Changing the getRelevantAbilities() method to return a Map<IOption, String> instead of a List.
  • Refactoring the fillAbilitiesAndImplants() method to iterate over the map of abilities and implants.
  • Updating documentation to reflect the new behavior and method contracts.

Comment on lines +1895 to +1904
< 8000 td data-line-number="1900" class="blob-num blob-num-addition">
int counter = 0;
for (IOption option : relevantAbilities.keySet()) {
int column = counter / skillsPerColumn; // 0, 1
int row = counter % skillsPerColumn;

SpecialAbility ability = relevantAbilities.get(i);
String name = ability.getDisplayName();
String description = ability.getDescription();
boolean isFlaw = ability.getCost() < -1; // -1 is used to designate an origin only SPA
String name = option.getDisplayableName();
String description = option.getDescription();

boolean isFlaw = false;
if (Objects.equals(relevantAbilities.get(option), LVL3_ADVANTAGES)) {
Copy link
Preview
Copilot AI May 10, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider refactoring the iteration over relevantAbilities by using a for-each loop over the Map.Entry<IOption, String> instead of manually managing the counter. This would improve code readability and maintainability.

Copilot uses AI. Check for mistakes.

@HammerGS HammerGS merged commit 90aa891 into MegaMek:master May 10, 2025
6 checks passed
@IllianiBird IllianiBird deleted the implantDisplay branch June 7, 2025 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GUI Severity: High Issues described as high severity as per the new issue form
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] NPE from implants
3 participants
0