@@ -2255,24 +2255,26 @@ void MetagameGUI::UpdateInput()
2255
2255
GUIEvent anEvent;
2256
2256
while (m_pGUIController->GetEvent (&anEvent))
2257
2257
{
2258
+ const std::string eventControlName = anEvent.GetControl ()->GetName ();
2259
+
2258
2260
// Commands
2259
2261
if (anEvent.GetType () == GUIEvent::Command)
2260
2262
{
2261
2263
// Open game menu button pressed
2262
2264
// 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" )
2268
2270
{
2269
2271
g_MetaMan.SetSuspend (true );
2270
2272
SwitchToScreen (MENUDIALOG);
2271
2273
g_GUISound.BackButtonPressSound ()->Play ();
2272
2274
}
2273
2275
2274
2276
// Return to main menu button pressed
2275
- if (anEvent. GetControl ()-> GetName () == " MainMenuButton" )
2277
+ else if (eventControlName == " MainMenuButton" || eventControlName == " NewCancelButton " )
2276
2278
{
2277
2279
// Return Metagame dialog to new game state
2278
2280
// weegee SwitchToScreen(NEWDIALOG);
@@ -2285,24 +2287,24 @@ void MetagameGUI::UpdateInput()
2285
2287
}
2286
2288
2287
2289
// Open save menu button pressed
2288
- if (anEvent. GetControl ()-> GetName () == " MenuSaveButton" )
2290
+ else if (eventControlName == " MenuSaveButton" )
2289
2291
{
2290
2292
g_MetaMan.SetSuspend (true );
2291
2293
SwitchToScreen (SAVEDIALOG);
2292
2294
g_GUISound.ButtonPressSound ()->Play ();
2293
2295
}
2294
2296
2295
2297
// Open load menu button pressed
2296
- if (anEvent. GetControl ()-> GetName () == " MenuLoadButton" ||
2297
- anEvent. GetControl ()-> GetName () == " NewLoadButton" )
2298
+ else if (eventControlName == " MenuLoadButton" ||
2299
+ eventControlName == " NewLoadButton" )
2298
2300
{
2299
2301
g_MetaMan.SetSuspend (true );
2300
2302
SwitchToScreen (LOADDIALOG);
2301
2303
g_GUISound.ButtonPressSound ()->Play ();
2302
2304
}
2303
2305
2304
2306
// New Game menu button pressed
2305
- if (anEvent. GetControl ()-> GetName () == " MenuNewButton" )
2307
+ else if (eventControlName == " MenuNewButton" )
2306
2308
{
2307
2309
g_MetaMan.SetSuspend (true );
2308
2310
SwitchToScreen (NEWDIALOG);
@@ -2311,7 +2313,7 @@ void MetagameGUI::UpdateInput()
2311
2313
}
2312
2314
2313
2315
// Quit Program button pressed
2314
- if (anEvent. GetControl ()-> GetName () == " MenuQuitButton" )
2316
+ else if (eventControlName == " MenuQuitButton" )
2315
2317
{
2316
2318
HideAllScreens ();
2317
2319
g_MetaMan.SetSuspend (true );
@@ -2322,7 +2324,7 @@ void MetagameGUI::UpdateInput()
2322
2324
}
2323
2325
2324
2326
// Resume Game menu button pressed
2325
- if (anEvent. GetControl ()-> GetName () == " MenuResumeButton" )
2327
+ else if (eventControlName == " MenuResumeButton" )
2326
2328
{
2327
2329
g_MetaMan.SetSuspend (false );
2328
2330
// If game over, then go to new game dialog on resume
@@ -2392,7 +2394,7 @@ void MetagameGUI::UpdateInput()
2392
2394
}
2393
2395
2394
2396
// Start New Game menu button pressed
2395
- if (anEvent. GetControl ()-> GetName () == " StartButton" )
2397
+ if (eventControlName == " StartButton" )
2396
2398
{
2397
2399
// Current game needs saved or there will be data loss, so show confirmation box
2398
2400
if (!g_MetaMan.GameIsSaved ())
@@ -2409,7 +2411,7 @@ void MetagameGUI::UpdateInput()
2409
2411
}
2410
2412
2411
2413
// Save game button pressed
2412
- if (anEvent. GetControl ()-> GetName () == " SaveButton" )
2414
+ if (eventControlName == " SaveButton" )
2413
2415
{
2414
2416
// Overwrite confirmation click has been done already
2415
2417
if (!m_NewSaveBox->GetText ().empty () || m_apMetaButton[SAVENOW]->GetText () != " Save" )
@@ -2443,7 +2445,7 @@ void MetagameGUI::UpdateInput()
2443
2445
}
2444
2446
2445
2447
// Load game button pressed
2446
- if (anEvent. GetControl ()-> GetName () == " LoadButton" && m_pSavesToLoadCombo->GetSelectedItem ())
2448
+ if (eventControlName == " LoadButton" && m_pSavesToLoadCombo->GetSelectedItem ())
2447
2449
{
2448
2450
// 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
2449
2451
m_pSelectedGameToLoad = m_pSavesToLoadCombo->GetSelectedItem ()->m_pEntity ;
0 commit comments