From 71e5051752b490ec5a84169fead140507222c5cb Mon Sep 17 00:00:00 2001 From: pierow Date: Tue, 26 Mar 2024 00:16:06 -0400 Subject: [PATCH] add cl_cmcancellast --- main/source/mod/AvHCommanderModeHandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/source/mod/AvHCommanderModeHandler.cpp b/main/source/mod/AvHCommanderModeHandler.cpp index 756fae2f..3d2aa3c9 100644 --- a/main/source/mod/AvHCommanderModeHandler.cpp +++ b/main/source/mod/AvHCommanderModeHandler.cpp @@ -568,13 +568,16 @@ void AvHCommanderModeHandler::SetMenuFromTechSlots(const AvHTechSlots& inTechSlo // else if we're placing a building or researching, don't display anything but cancel else if((gHUD.GetGhostBuilding() != MESSAGE_NULL) || (theIsResearching && !theIsBuilding)) { - // Set last button as cancel theActionButtons->SetButton(0, MENU_BUILD); theActionButtons->SetButton(1, MENU_BUILD_ADVANCED); theActionButtons->SetButton(2, MENU_ASSIST); theActionButtons->SetButton(3, MENU_EQUIP); - theActionButtons->SetButton(kNumActionButtonRows*kNumActionButtonCols - 1, MESSAGE_CANCEL); + // Set second to last button as cancel, unless the player enables it being the last button. Changed to prevent accidental recycles and because C = cancel makes sense. + if (CVAR_GET_FLOAT("cl_cmcancellast") == 1.0f) + theActionButtons->SetButton(kNumActionButtonRows*kNumActionButtonCols - 1, MESSAGE_CANCEL); + else + theActionButtons->SetButton(kNumActionButtonRows * kNumActionButtonCols - 2, MESSAGE_CANCEL); } // else use the menu the server specifies else