Skip to content

subtype flags merged with flags#8469

Merged
HammerGS merged 6 commits into
MegaMek:mainfrom
exeea:flagsmerge
Jan 6, 2026
Merged

subtype flags merged with flags#8469
HammerGS merged 6 commits into
MegaMek:mainfrom
exeea:flagsmerge

Conversation

@exeea

@exeea exeea commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator

subtype flags merged with flags
Requires MegaMek/megamek#7758

Copilot AI review requested due to automatic review settings December 11, 2025 23:37
@exeea exeea requested a review from a team as a code owner December 11, 2025 23:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 migrates MiscType equipment checks from the old subtype API (hasSubType() and bitwise operations on getSubType()) to the new flag-based API (hasFlag() and hasAnyFlag() using MiscTypeFlag enum). This change aligns with a corresponding MegaMek API update.

Key Changes:

  • Replaced hasSubType(MiscType.S_*) calls with hasFlag(MiscTypeFlag.S_*)
  • Replaced bitwise AND checks like (type.getSubType() & MiscType.S_SUPERCHARGER) == 0 with !type.hasFlag(MiscTypeFlag.S_SUPERCHARGER)
  • Used hasAnyFlag() for conditions that check multiple alternative subtypes

Reviewed changes

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

Show a summary per file
File Description
MissingOmniPod.java Updated SUPERCHARGER check from bitwise operation to hasFlag() negation
MissingMASC.java Migrated isSupercharger() method from hasSubType() to hasFlag()
MissingJumpJet.java Converted improved jump jet check from hasSubType() to hasFlag()
MASC.java Migrated isSupercharger() method from hasSubType() to hasFlag()
EquipmentPart.java Updated multiple subtype checks for club weapons, converting to hasFlag() and hasAnyFlag()
OmniPod.java Updated SUPERCHARGER check from bitwise operation to hasFlag() negation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MekHQ/src/mekhq/campaign/parts/OmniPod.java
@Sleet01

Sleet01 commented Dec 13, 2025

Copy link
Copy Markdown
Collaborator

The required PR can't be merged so this can't be merged.
Looks like the tests are failing due to missing these MiscTypes:

            if (armorKit.hasSubType(MiscType.S_SPACE_SUIT)
                                            ^
  symbol:   variable S_SPACE_SUIT
  location: class MiscType
/home/runner/work/megamek/megamek/megamek/megamek/src/megamek/common/units/Infantry.java:2039: error: cannot find symbol
                  || armorKit.hasSubType(MiscType.S_XCT_VACUUM)
                                                 ^
  symbol:   variable S_XCT_VACUUM
  location: class MiscType
/home/runner/work/megamek/megamek/megamek/megamek/src/megamek/common/units/Infantry.java:2040: error: cannot find symbol
                  || armorKit.hasSubType(MiscType.S_TOXIC_ATMOSPHERE)) {

Do you have a change that you haven't committed?

@IllianiBird

Copy link
Copy Markdown
Collaborator

Flipping to draft to prevent merging prior to 50.11 launch

@IllianiBird IllianiBird marked this pull request as draft December 14, 2025 23:27
@exeea exeea marked this pull request as ready for review January 6, 2026 10:31
@codecov

codecov Bot commented Jan 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 12.61%. Comparing base (d0ed991) to head (f8b0048).
⚠️ Report is 61 commits behind head on main.

Files with missing lines Patch % Lines
MekHQ/src/mekhq/campaign/market/PartsStore.java 0.00% 10 Missing ⚠️
.../mekhq/campaign/parts/equipment/EquipmentPart.java 0.00% 10 Missing ⚠️
MekHQ/src/mekhq/campaign/parts/OmniPod.java 0.00% 1 Missing ⚠️
...HQ/src/mekhq/campaign/parts/equipment/JumpJet.java 0.00% 0 Missing and 1 partial ⚠️
MekHQ/src/mekhq/campaign/parts/equipment/MASC.java 0.00% 1 Missing ⚠️
...mekhq/campaign/parts/equipment/MissingJumpJet.java 0.00% 1 Missing ⚠️
...rc/mekhq/campaign/parts/equipment/MissingMASC.java 0.00% 1 Missing ⚠️
...c/mekhq/campaign/parts/missing/MissingOmniPod.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8469   +/-   ##
=========================================
  Coverage     12.61%   12.61%           
- Complexity     7701     7702    +1     
=========================================
  Files          1302     1302           
  Lines        167217   167217           
  Branches      25184    25184           
=========================================
+ Hits          21094    21097    +3     
+ Misses       144028   144025    -3     
  Partials       2095     2095           

☔ 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 merged commit d31246b into MegaMek:main Jan 6, 2026
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants