diff --git a/Core/GameEngine/Include/GameNetwork/LANGameInfo.h b/Core/GameEngine/Include/GameNetwork/LANGameInfo.h index 2d0cdbd202a..a3dc0c1a719 100644 --- a/Core/GameEngine/Include/GameNetwork/LANGameInfo.h +++ b/Core/GameEngine/Include/GameNetwork/LANGameInfo.h @@ -171,6 +171,7 @@ class LANGameInfo : public GameInfo void LANDisplayGameList( GameWindow *gameListbox, LANGameInfo *gameList ); ///< Displays the list of games in a listbox, preserving selections void LANEnableStartButton(Bool enabled); +void LANDisableButtons(); void LANDisplaySlotList(); ///< Displays the slot list according to TheLANGameInfo void LANDisplayGameOptions(); ///< Displays the game options according to TheLANGameInfo diff --git a/Core/GameEngine/Source/GameNetwork/LANAPI.cpp b/Core/GameEngine/Source/GameNetwork/LANAPI.cpp index 1016d26f66b..305422c848d 100644 --- a/Core/GameEngine/Source/GameNetwork/LANAPI.cpp +++ b/Core/GameEngine/Source/GameNetwork/LANAPI.cpp @@ -589,6 +589,13 @@ void LANAPI::update() // m_gameStartTime is when the next message goes out // m_gameStartSeconds is how many seconds remain in the message + if (m_gameStartSeconds == 1) + { + // TheSuperHackers @bugfix Disable LAN menu buttons early to avoid a rare crash + // that may happen when using the buttons at the last moment (after they're deinitialized). + LANDisableButtons(); + } + RequestGameStartTimer( m_gameStartSeconds ); } else if (m_gameStartTime && m_gameStartTime <= now) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index 4072ce98ad5..639b8fbe73c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -389,6 +389,25 @@ void LANEnableStartButton(Bool enabled) buttonSelectMap->winEnable(enabled); } +void LANDisableButtons() +{ + buttonStart->winEnable(false); + buttonBack->winEnable(false); + buttonSelectMap->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); + buttonAccept[i]->winEnable(false); + buttonMapStartPosition[i]->winEnable(false); + } +} + static void handleColorSelection(int index) { GameWindow *combo = comboBoxColor[index];