File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
MekHQ/src/mekhq/gui/adapter Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 3232 */
3333package mekhq .gui .adapter ;
3434
35+ import static mekhq .campaign .unit .Unit .SITE_FIELD_WORKSHOP ;
36+
3537import java .awt .event .ActionEvent ;
3638import java .util .Optional ;
3739import javax .swing .JCheckBoxMenuItem ;
4143import javax .swing .JPopupMenu ;
4244import javax .swing .JTable ;
4345
46+ import megamek .codeUtilities .MathUtility ;
4447import megamek .common .equipment .AmmoType ;
4548import mekhq .MekHQ ;
4649import mekhq .Utilities ;
@@ -95,7 +98,7 @@ public void actionPerformed(ActionEvent action) {
9598 MekHQ .triggerEvent (new UnitChangedEvent (selectedUnit ));
9699 }
97100 } else if (command .contains ("CHANGE_SITE" )) {
98- int selected = Integer .parseInt (command .split (":" )[1 ]);
101+ int selected = MathUtility .parseInt (command .split (":" )[1 ], SITE_FIELD_WORKSHOP );
99102 boolean selectedIsValid = selected > -1 && selected < Unit .SITE_UNKNOWN ;
100103 if (!selectedIsValid ) {
101104 return ;
Original file line number Diff line number Diff line change 4141import static mekhq .campaign .enums .DailyReportType .TECHNICAL ;
4242import static mekhq .campaign .market .personnelMarket .enums .PersonnelMarketStyle .MEKHQ ;
4343import static mekhq .campaign .personnel .PersonUtility .overrideSkills ;
44+ import static mekhq .campaign .unit .Unit .SITE_FIELD_WORKSHOP ;
4445
4546import java .awt .event .ActionEvent ;
4647import java .awt .event .MouseEvent ;
6667import megamek .client .ui .dialogs .UnitEditorDialog ;
6768import megamek .client .ui .dialogs .abstractDialogs .BVDisplayDialog ;
6869import megamek .client .ui .dialogs .iconChooser .CamoChooserDialog ;
70+ import megamek .codeUtilities .MathUtility ;
6971import megamek .common .annotations .Nullable ;
7072import megamek .common .enums .SkillLevel ;
7173import megamek .common .equipment .AmmoType ;
@@ -318,7 +320,7 @@ public void actionPerformed(ActionEvent action) {
318320 MekHQ .triggerEvent (new UnitChangedEvent (selectedUnit ));
319321 }
320322 } else if (command .contains (COMMAND_CHANGE_SITE )) {
321- int selected = Integer .parseInt (command .split (":" )[1 ]);
323+ int selected = MathUtility .parseInt (command .split (":" )[1 ], SITE_FIELD_WORKSHOP );
322324 boolean selectedIsValid = selected > -1 && selected < Unit .SITE_UNKNOWN ;
323325 if (!selectedIsValid ) {
324326 return ;
You can’t perform that action at this time.
0 commit comments