Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1152,9 +1152,13 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
{
if (LANbuttonPushed)
break;

LANGameInfo* myGame = TheLAN->GetMyGame();
if (myGame->isGameInProgress())
return MSG_IGNORED;
Comment thread
xezon marked this conversation as resolved.

GameWindow *control = (GameWindow *)mData1;
Int controlID = control->winGetWindowId();
LANGameInfo *myGame = TheLAN->GetMyGame();

if ( controlID == comboBoxStartingCashID )
{
Expand Down Expand Up @@ -1220,6 +1224,11 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
{
if (LANbuttonPushed)
break;

LANGameInfo* myGame = TheLAN->GetMyGame();
if (myGame->isGameInProgress())
Comment thread
xezon marked this conversation as resolved.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is very suspicious that the menu can still be interacted with after it was shutdown. Why is this possible? Is there maybe a general issue with menus?

Copy link
Copy Markdown
Author

@Caball009 Caball009 May 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is because of a general issues with menus. The game just nulls the button pointers before it changes the window / takes away control from the user.

Perhaps from user perspective the cleanest solution would be to disable (grey out) the buttons when the timer has zero seconds remaining. I don't know how to access the buttons in the code that has access to the timer, though.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if the window is changed or control is taken before the button pointers are nulled. That way no special safe guards need to be placed in multiple handlers.

Is the issue maybe that the handling of a button press is delayed by 1 or multiple frames because of input system updates, and so it can arrive after the menu screen was destroyed? If so, maybe the solution here is to add a condition into every menu input handler and check that the owning menu is still active, and if not, return early and do not handle the input.

return MSG_IGNORED;

GameWindow *control = (GameWindow *)mData1;
Int controlID = control->winGetWindowId();

Expand Down Expand Up @@ -1270,7 +1279,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
TheLAN->RequestAccept();

// Disable the accept button
EnableAcceptControls(TRUE, TheLAN->GetMyGame(), comboBoxPlayer, comboBoxColor, comboBoxPlayerTemplate,
EnableAcceptControls(TRUE, myGame, comboBoxPlayer, comboBoxColor, comboBoxPlayerTemplate,
comboBoxTeam, buttonAccept, buttonStart, buttonMapStartPosition);

}
Expand All @@ -1285,11 +1294,10 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
{
if (controlID == buttonMapStartPositionID[i])
{
LANGameInfo *game = TheLAN->GetMyGame();
Int playerIdxInPos = -1;
for (Int j=0; j<MAX_SLOTS; ++j)
{
LANGameSlot *slot = game->getLANSlot(j);
LANGameSlot *slot = myGame->getLANSlot(j);
if (slot && slot->getStartPos() == i)
{
playerIdxInPos = j;
Expand All @@ -1298,8 +1306,8 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
}
if (playerIdxInPos >= 0)
{
LANGameSlot *slot = game->getLANSlot(playerIdxInPos);
if (playerIdxInPos == game->getLocalSlotNum() || (game->amIHost() && slot && slot->isAI()))
LANGameSlot *slot = myGame->getLANSlot(playerIdxInPos);
if (playerIdxInPos == myGame->getLocalSlotNum() || (myGame->amIHost() && slot && slot->isAI()))
{
// it's one of my type. Try to change it.
Int nextPlayer = getNextSelectablePlayer(playerIdxInPos+1);
Expand All @@ -1315,7 +1323,7 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
// nobody in the slot - put us in
Int nextPlayer = getNextSelectablePlayer(0);
if (nextPlayer < 0)
nextPlayer = getFirstSelectablePlayer(game);
nextPlayer = getFirstSelectablePlayer(myGame);
handleStartPositionSelection(nextPlayer, i);
}
}
Expand All @@ -1330,17 +1338,21 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
if (LANbuttonPushed)
break;

LANGameInfo* myGame = TheLAN->GetMyGame();
if (myGame->isGameInProgress())
return MSG_IGNORED;

GameWindow *control = (GameWindow *)mData1;
Int controlID = control->winGetWindowId();

for (Int i = 0; i < MAX_SLOTS; i++)
{
if (controlID == buttonMapStartPositionID[i])
{
LANGameInfo *game = TheLAN->GetMyGame();
Int playerIdxInPos = -1;
for (Int j=0; j<MAX_SLOTS; ++j)
{
LANGameSlot *slot = game->getLANSlot(j);
LANGameSlot *slot = myGame->getLANSlot(j);
if (slot && slot->getStartPos() == i)
{
playerIdxInPos = j;
Expand All @@ -1349,8 +1361,8 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
}
if (playerIdxInPos >= 0)
{
LANGameSlot *slot = game->getLANSlot(playerIdxInPos);
if (playerIdxInPos == game->getLocalSlotNum() || (game->amIHost() && slot && slot->isAI()))
LANGameSlot *slot = myGame->getLANSlot(playerIdxInPos);
if (playerIdxInPos == myGame->getLocalSlotNum() || (myGame->amIHost() && slot && slot->isAI()))
{
// it's one of my type. Remove it.
handleStartPositionSelection(playerIdxInPos, -1);
Expand All @@ -1365,6 +1377,11 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m
{
if (LANbuttonPushed)
break;

LANGameInfo* myGame = TheLAN->GetMyGame();
if (myGame->isGameInProgress())
return MSG_IGNORED;

GameWindow *control = (GameWindow *)mData1;
Int controlID = control->winGetWindowId();

Expand Down
Loading