-
Notifications
You must be signed in to change notification settings - Fork 191
Fix: Fixed a Handful of Calls to Unsafe Faction Standing Getters #7275
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
Fix: Fixed a Handful of Calls to Unsafe Faction Standing Getters #7275
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7275 +/- ##
============================================
- Coverage 12.75% 12.75% -0.01%
Complexity 7541 7541
============================================
Files 1148 1149 +1
Lines 147806 147820 +14
Branches 22593 22593
============================================
+ Hits 18854 18855 +1
- Misses 126935 126944 +9
- Partials 2017 2021 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 replaces calls to the unsafe faction standing getters with their “Safe” variants to avoid repeated manual tracking checks.
- Swapped
isUseFactionStandingBatchallRestrictions()
forisUseFactionStandingBatchallRestrictionsSafe()
in batchall logic - Updated enemy and campaign jump path checks to use
isUseFactionStandingBatchallRestrictionsSafe()
andisUseFactionStandingOutlawedSafe()
- Ensures all faction standing–based restrictions now use safe getters
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
MekHQ/src/mekhq/campaign/universe/factionStanding/PerformBatchall.java | Use safe batchall restriction flag |
MekHQ/src/mekhq/campaign/mission/AtBContract.java | Switch to safe batchall restriction in enemy update |
MekHQ/src/mekhq/campaign/Campaign.java | Apply safe variants for batchall and outlawed checks |
Comments suppressed due to low confidence (3)
MekHQ/src/mekhq/campaign/universe/factionStanding/PerformBatchall.java:95
- Add a unit test covering the branch where
isUseFactionStandingBatchallRestrictionsSafe()
returns false to ensure batchall operations bypass the standing check as intended.
if (campaign.getCampaignOptions().isUseFactionStandingBatchallRestrictionsSafe()) {
MekHQ/src/mekhq/campaign/mission/AtBContract.java:633
- Introduce a test for the
false
case ofisUseFactionStandingBatchallRestrictionsSafe()
inupdateEnemy(...)
to verify thatallowBatchalls
remains true when restrictions are disabled.
if (campaign.getCampaignOptions().isUseFactionStandingBatchallRestrictionsSafe()) {
MekHQ/src/mekhq/campaign/Campaign.java:5049
- [nitpick] Consider adding or updating Javadoc on
isUseFactionStandingBatchallRestrictionsSafe()
to clarify how it differs from the legacy method and its default behavior.
if (campaignOptions.isUseFactionStandingBatchallRestrictionsSafe()) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
# Conflicts: # MekHQ/src/mekhq/campaign/Campaign.java
We should be using the safe variants, as that avoids needing to check whether faction standing is being tracked every time we call the getter