-
Notifications
You must be signed in to change notification settings - Fork 176
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
Added Handling for Unsupported Unit Types #5720
Conversation
Added functionality to automatically sell unsupported units, such as gun emplacements, upon campaign load. Affected units are listed in a notification to the user, and their assigned personnel are unassigned. Updated resource bundle and supporting methods to accommodate this change.
Excluded gun emplacements from salvage as they are unsupported in MekHQ. This ensures consistency and avoids unintended gameplay behavior during scenario resolution.
Prevented the selection of Gun Emplacement units in MekHQ if they are unsupported. Added a user-facing message indicating the restriction and integrated appropriate resource strings for localization. This ensures better handling of unsupported unit types.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5720 +/- ##
============================================
+ Coverage 10.03% 10.21% +0.17%
- Complexity 6069 6070 +1
============================================
Files 1074 1009 -65
Lines 141525 139242 -2283
Branches 20666 20437 -229
============================================
+ Hits 14209 14221 +12
+ Misses 125944 123651 -2293
+ Partials 1372 1370 -2 ☔ View full report in Codecov by Sentry. |
if (!soldUnits.isEmpty()) { | ||
StringBuilder message = new StringBuilder(resources.getString("unsupportedUnits.body")); | ||
|
||
for (Unit soldUnit : soldUnits) { | ||
retVal.getQuartermaster().sellUnit(soldUnit); | ||
message.append("- ").append(soldUnit.getName()).append("<br>"); | ||
} | ||
|
||
JOptionPane.showMessageDialog(null, | ||
String.format("<html>%s</html>", message), | ||
resources.getString("unsupportedUnits.title"), | ||
JOptionPane.WARNING_MESSAGE); | ||
} |
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.
this can't be in a static function because it has reference to the resources, which is in the base instance.
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.
That was fixed a while ago - if you're referring to what I think you are. If you update your master it should be good.
Unsupported unit types are handled in the following manner: