10000 Improvement: When Selecting Change Profession Categorize Professions Based on SubType by IllianiBird · Pull Request #6915 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improvement: When Selecting Change Profession Categorize Professions Based on SubType #6915

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

Conversation

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

Requires #6914

image

This change makes assignment cleaner for personnel who qualify for a large number of professions and is prep work for an upcoming feature.

@IllianiBird IllianiBird self-assigned this May 7, 2025
@IllianiBird IllianiBird added GUI UX User experience labels May 7, 2025
@IllianiBird IllianiBird changed the title Categorized profession assignment Improvement: When Selecting Change Profession Categorize Professions Based on SubType May 7, 2025
Copy link
codecov bot commented May 7, 2025

Codecov Report

Attention: Patch coverage is 55.22388% with 30 lines in your changes missing coverage. Please review.

Project coverage is 11.71%. Comparing base (843ebb1) to head (0cbee5c).
Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
.../mekhq/gui/adapter/PersonnelTableMouseAdapter.java 0.00% 28 Missing ⚠️
.../mekhq/campaign/personnel/enums/PersonnelRole.java 97.22% 0 Missing and 1 partial ⚠️
...campaign/personnel/enums/PersonnelRoleSubType.java 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6915      +/-   ##
============================================
- Coverage     11.71%   11.71%   -0.01%     
- Complexity     6668     6670       +2     
============================================
  Files          1100     1101       +1     
  Lines        141383   141414      +31     
  Branches      21891    21901      +10     
============================================
  Hits          16568    16568              
- Misses       123115   123144      +29     
- Partials       1700     1702       +2     

☔ 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.

@HammerGS HammerGS requested a review from Copilot May 7, 2025 23:51
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 PR refines the categorization of professions by introducing a PersonnelRoleSubType to separate roles into Combat, Support, and Civilian, thereby cleaning up the assignment logic for personnel with many professions. It updates the popup menus in the GUI to reflect these categories, refactors the PersonnelRole enum to use the new subtype concept, and adjusts resource strings accordingly.

  • Updated enum constructors and methods in PersonnelRole for subtype handling
  • Added categorized submenu construction for primary and secondary roles in PersonnelTableMouseAdapter
  • Introduced PersonnelRoleSubType enum and updated resource property labels

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
MekHQ/src/mekhq/gui/adapter/PersonnelTableMouseAdapter.java Revised popup menu creation with categorized submenus based on role subtype
MekHQ/src/mekhq/campaign/personnel/enums/PersonnelRoleSubType.java New enum to represent role subtypes with internationalized labels
MekHQ/src/mekhq/campaign/personnel/enums/PersonnelRole.java Updated enum to use PersonnelRoleSubType and refactored role boolean methods accordingly
MekHQ/resources/mekhq/resources/PersonnelRoleSubType.properties Added labels for the new role subtypes
MekHQ/resources/mekhq/resources/GUI.properties Updated strings to reference “Profession” instead of “Role” along with subtype labels
Comments suppressed due to low confidence (1)

MekHQ/src/mekhq/campaign/personnel/enums/PersonnelRole.java:569

  • [nitpick] The change in isSupport() now includes civilian roles, but the Javadoc still references 'support' in a general manner. Consider updating the documentation to clearly explain that civilian roles are treated as support in this context.
public boolean isSupport() { return isSubType(PersonnelRoleSubType.SUPPORT) || isSubType(PersonnelRoleSubType.CIVILIAN);

if (menuSupportPrimary.getItemCount() > 0) {
menu.add(menuSupportPrimary);
}
if (menuCivilianPrimary.getItemCount() > 0) {
Copy link
Preview
Copilot AI May 7, 2025

Choose a reason for hiding this comment

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

The logic for creating and adding categorized submenus for both primary and secondary roles is duplicated. Consider refactoring this logic into a helper method to streamline future updates.

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As we need to return three different, unique, lists to make this fit with legacy code it would be a pain to do.

In the land of wishes and fairies I'd have the time to completely rewrite and modernize these context menus, but that is not today.

@HammerGS HammerGS merged commit d18b518 into MegaMek:master May 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI UX User experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0