From 8cfdce510ff3ac3b84ff11f1affb61a9a483ae25 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Fri, 20 Dec 2024 15:48:15 -0600 Subject: [PATCH] Refined "Undeploy" menu behavior for GM permissions. Updated "Undeploy Force" and "Undeploy Unit" menu items to include "(GM)" labels and adjusted their enabled state to consider GM status. Ensured General Managers can override Strategic Con options when applicable. Improved clarity and functionality for deployment management. --- MekHQ/src/mekhq/gui/adapter/TOEMouseAdapter.java | 8 ++++---- MekHQ/src/mekhq/gui/adapter/UnitTableMouseAdapter.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MekHQ/src/mekhq/gui/adapter/TOEMouseAdapter.java b/MekHQ/src/mekhq/gui/adapter/TOEMouseAdapter.java index af2761d92e..3b31747e2d 100644 --- a/MekHQ/src/mekhq/gui/adapter/TOEMouseAdapter.java +++ b/MekHQ/src/mekhq/gui/adapter/TOEMouseAdapter.java @@ -1134,10 +1134,10 @@ protected Optional createPopupMenu() { } if (StaticChecks.areAllForcesDeployed(forces)) { - menuItem = new JMenuItem("Undeploy Force"); + menuItem = new JMenuItem("Undeploy Force (GM)"); menuItem.setActionCommand(TOEMouseAdapter.COMMAND_UNDEPLOY_FORCE + forceIds); menuItem.addActionListener(this); - menuItem.setEnabled(!gui.getCampaign().getCampaignOptions().isUseStratCon()); + menuItem.setEnabled(gui.getCampaign().isGM() || !gui.getCampaign().getCampaignOptions().isUseStratCon()); popup.add(menuItem); } @@ -1635,10 +1635,10 @@ protected Optional createPopupMenu() { } if (StaticChecks.areAllUnitsDeployed(units)) { - menuItem = new JMenuItem("Undeploy Unit"); + menuItem = new JMenuItem("Undeploy Unit (GM)"); menuItem.setActionCommand(TOEMouseAdapter.COMMAND_UNDEPLOY_UNIT + unitIds); menuItem.addActionListener(this); - menuItem.setEnabled(!gui.getCampaign().getCampaignOptions().isUseStratCon()); + menuItem.setEnabled(gui.getCampaign().isGM() || !gui.getCampaign().getCampaignOptions().isUseStratCon()); popup.add(menuItem); } diff --git a/MekHQ/src/mekhq/gui/adapter/UnitTableMouseAdapter.java b/MekHQ/src/mekhq/gui/adapter/UnitTableMouseAdapter.java index d610dde642..1c2dfad7f4 100644 --- a/MekHQ/src/mekhq/gui/adapter/UnitTableMouseAdapter.java +++ b/MekHQ/src/mekhq/gui/adapter/UnitTableMouseAdapter.java @@ -1006,10 +1006,10 @@ protected Optional createPopupMenu() { } if (oneDeployed) { - menuItem = new JMenuItem("Undeploy Unit"); + menuItem = new JMenuItem("Undeploy Unit (GM)"); menuItem.setActionCommand(COMMAND_UNDEPLOY); menuItem.addActionListener(this); - menuItem.setEnabled(!gui.getCampaign().getCampaignOptions().isUseStratCon()); + menuItem.setEnabled(gui.getCampaign().isGM() || !gui.getCampaign().getCampaignOptions().isUseStratCon()); menu.add(menuItem); }