From ed4d1f237f4bd0c51278339852b7b07099a50eb4 Mon Sep 17 00:00:00 2001 From: Ibra Date: Fri, 26 Jun 2026 01:37:04 +0300 Subject: [PATCH] fix: Prevent custom lobby setting mismatches --- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index d5f6683e5fe..d7d02a5623a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -932,6 +932,22 @@ static void handleLimitSuperweaponsClick() #endif } +static void WOLLockSettings() +{ + buttonBack->winEnable(false); + checkBoxLimitSuperweapons->winEnable(false); + comboBoxStartingCash->winEnable(false); + + for (Int i = 0; i < MAX_SLOTS; ++i) + { + comboBoxPlayer[i]->winEnable(false); + comboBoxColor[i]->winEnable(false); + comboBoxPlayerTemplate[i]->winEnable(false); + comboBoxTeam[i]->winEnable(false); + buttonMapStartPosition[i]->winEnable(false); + } +} + static void StartPressed() { Bool isReady = TRUE; @@ -1107,13 +1123,6 @@ static void StartPressed() std::shared_ptr pWS = NGMP_OnlineServicesManager::GetWebSocket(); if (pWS != nullptr) { - // we've started, there's no going back - // i.e. disable the back button. - if (buttonBack != nullptr) - { - buttonBack->winEnable(FALSE); - } - if (buttonStart != nullptr) { buttonStart->winEnable(FALSE); @@ -1157,6 +1166,7 @@ static void StartPressed() pLobbyInterface->SendAnnouncementMessageToCurrentLobby(strInform, true); TheNGMPGame->StartCountdown(); + buttonSelectMap->winEnable(FALSE); } } #endif @@ -1880,9 +1890,6 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) // TODO_NGMP //SendStatsToOtherPlayers(TheNGMPGame); - // we've started, there's no going back - // i.e. disable the back button. - buttonBack->winEnable(FALSE); GameWindow* buttonBuddy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); if (buttonBuddy) buttonBuddy->winEnable(FALSE); @@ -2468,16 +2475,23 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) // remote msg UnicodeString strInform; if (secondsRemaining == 1) + { + // Lock all host controlled lobby settings last second of the match start countdown + // to prevent late local changes not propagating to remote clients in time + WOLLockSettings(); + strInform.format(TheGameText->fetch("LAN:GameStartTimerSingular"), secondsRemaining); + } else + { strInform.format(TheGameText->fetch("LAN:GameStartTimerPlural"), secondsRemaining); + } NGMP_OnlineServices_LobbyInterface* pLobbyInterface = NGMP_OnlineServicesManager::GetInterface(); if (pLobbyInterface != nullptr) { pLobbyInterface->SendAnnouncementMessageToCurrentLobby(strInform, true); } - // are we done? if (secondsRemaining <= 0) @@ -2513,6 +2527,11 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) { buttonStart->winEnable(TRUE); } + + if (buttonStart != nullptr) + { + buttonSelectMap->winEnable(TRUE); + } } } @@ -2679,9 +2698,6 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) SendStatsToOtherPlayers(TheNGMPGame); - // we've started, there's no going back - // i.e. disable the back button. - buttonBack->winEnable(FALSE); GameWindow *buttonBuddy = TheWindowManager->winGetWindowFromId(NULL, NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator")); if (buttonBuddy) buttonBuddy->winEnable(FALSE);