Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 5a40670

Browse files
committed
"Cancel" in the metagame setup screen
Leads back to main menu if a metagame has not been started, and to the metagame menu otherwise.
1 parent 7250db8 commit 5a40670

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

Menus/MetagameGUI.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,24 +2255,26 @@ void MetagameGUI::UpdateInput()
22552255
GUIEvent anEvent;
22562256
while(m_pGUIController->GetEvent(&anEvent))
22572257
{
2258+
const std::string eventControlName = anEvent.GetControl()->GetName();
2259+
22582260
// Commands
22592261
if (anEvent.GetType() == GUIEvent::Command)
22602262
{
22612263
// Open game menu button pressed
22622264
// Most big dialog cancel buttons lead back to the game menu too
2263-
if (anEvent.GetControl()->GetName() == "OpenMenuButton" ||
2264-
anEvent.GetControl()->GetName() == "SaveCancelButton" ||
2265-
anEvent.GetControl()->GetName() == "LoadCancelButton" ||
2266-
anEvent.GetControl()->GetName() == "NewCancelButton" ||
2267-
anEvent.GetControl()->GetName() == "ConfirmCancelButton")
2265+
if (eventControlName == "OpenMenuButton" ||
2266+
eventControlName == "SaveCancelButton" ||
2267+
eventControlName == "LoadCancelButton" ||
2268+
(eventControlName == "NewCancelButton" && g_MetaMan.GameInProgress()) ||
2269+
eventControlName == "ConfirmCancelButton")
22682270
{
22692271
g_MetaMan.SetSuspend(true);
22702272
SwitchToScreen(MENUDIALOG);
22712273
g_GUISound.BackButtonPressSound()->Play();
22722274
}
22732275

22742276
// Return to main menu button pressed
2275-
if (anEvent.GetControl()->GetName() == "MainMenuButton")
2277+
else if (eventControlName == "MainMenuButton" || eventControlName == "NewCancelButton")
22762278
{
22772279
//Return Metagame dialog to new game state
22782280
// weegee SwitchToScreen(NEWDIALOG);
@@ -2285,24 +2287,24 @@ void MetagameGUI::UpdateInput()
22852287
}
22862288

22872289
// Open save menu button pressed
2288-
if (anEvent.GetControl()->GetName() == "MenuSaveButton")
2290+
else if (eventControlName == "MenuSaveButton")
22892291
{
22902292
g_MetaMan.SetSuspend(true);
22912293
SwitchToScreen(SAVEDIALOG);
22922294
g_GUISound.ButtonPressSound()->Play();
22932295
}
22942296

22952297
// Open load menu button pressed
2296-
if (anEvent.GetControl()->GetName() == "MenuLoadButton" ||
2297-
anEvent.GetControl()->GetName() == "NewLoadButton")
2298+
else if (eventControlName == "MenuLoadButton" ||
2299+
eventControlName == "NewLoadButton")
22982300
{
22992301
g_MetaMan.SetSuspend(true);
23002302
SwitchToScreen(LOADDIALOG);
23012303
g_GUISound.ButtonPressSound()->Play();
23022304
}
23032305

23042306
// New Game menu button pressed
2305-
if (anEvent.GetControl()->GetName() == "MenuNewButton")
2307+
else if (eventControlName == "MenuNewButton")
23062308
{
23072309
g_MetaMan.SetSuspend(true);
23082310
SwitchToScreen(NEWDIALOG);
@@ -2311,7 +2313,7 @@ void MetagameGUI::UpdateInput()
23112313
}
23122314

23132315
// Quit Program button pressed
2314-
if (anEvent.GetControl()->GetName() == "MenuQuitButton")
2316+
else if (eventControlName == "MenuQuitButton")
23152317
{
23162318
HideAllScreens();
23172319
g_MetaMan.SetSuspend(true);
@@ -2322,7 +2324,7 @@ void MetagameGUI::UpdateInput()
23222324
}
23232325

23242326
// Resume Game menu button pressed
2325-
if (anEvent.GetControl()->GetName() == "MenuResumeButton")
2327+
else if (eventControlName == "MenuResumeButton")
23262328
{
23272329
g_MetaMan.SetSuspend(false);
23282330
// If game over, then go to new game dialog on resume
@@ -2392,7 +2394,7 @@ void MetagameGUI::UpdateInput()
23922394
}
23932395

23942396
// Start New Game menu button pressed
2395-
if (anEvent.GetControl()->GetName() == "StartButton")
2397+
if (eventControlName == "StartButton")
23962398
{
23972399
// Current game needs saved or there will be data loss, so show confirmation box
23982400
if (!g_MetaMan.GameIsSaved())
@@ -2409,7 +2411,7 @@ void MetagameGUI::UpdateInput()
24092411
}
24102412

24112413
// Save game button pressed
2412-
if (anEvent.GetControl()->GetName() == "SaveButton")
2414+
if (eventControlName == "SaveButton")
24132415
{
24142416
// Overwrite confirmation click has been done already
24152417
if (!m_NewSaveBox->GetText().empty() || m_apMetaButton[SAVENOW]->GetText() != "Save")
@@ -2443,7 +2445,7 @@ void MetagameGUI::UpdateInput()
24432445
}
24442446

24452447
// Load game button pressed
2446-
if (anEvent.GetControl()->GetName() == "LoadButton" && m_pSavesToLoadCombo->GetSelectedItem())
2448+
if (eventControlName == "LoadButton" && m_pSavesToLoadCombo->GetSelectedItem())
24472449
{
24482450
// Save this Entity selection because the ComboBox gets cleared out when the conf dlg appears, so we can't get to the selection later when we acutally decide to load the damn thing
24492451
m_pSelectedGameToLoad = m_pSavesToLoadCombo->GetSelectedItem()->m_pEntity;

0 commit comments

Comments
 (0)