diff --git a/src/frontend.c b/src/frontend.c index 13a5bc64e..a700e27b5 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -74,13 +74,14 @@ // Global variables static int StartWithGame = 1; // New game starts in Cam 1. -bool multiplayersetup = false; // Skirmish or multiplayer setup? Used to go back to the corresponding menu. // Widget code and non-constant strings do not get along static char resolution[WIDG_MAXSTR]; static char textureSize[WIDG_MAXSTR]; tMode titleMode; // the global case +tMode lastTitleMode; // Since skirmish and multiplayer setup use the same functions, we use this to go back to the corresponding menu. + char aLevelName[MAX_LEVEL_NAME_SIZE+1]; //256]; // vital! the wrf file to use. BOOL bLimiterLoaded = false; @@ -463,7 +464,7 @@ BOOL runSinglePlayerMenu(void) case FRONTEND_SKIRMISH: ingame.bHostSetup = true; - multiplayersetup = false; + lastTitleMode = SINGLE; changeTitleMode(MULTIOPTION); break; @@ -536,7 +537,7 @@ BOOL runMultiPlayerMenu(void) bMultiPlayer = true; bMultiMessages = true; game.type = SKIRMISH; // needed? - multiplayersetup = true; + lastTitleMode = MULTI; changeTitleMode(MULTIOPTION); break; case FRONTEND_JOIN: @@ -901,7 +902,7 @@ BOOL runGameOptions3Menu(void) // If close button pressed then return from this menu. if(CancelPressed()) { - changeTitleMode(TITLE); + changeTitleMode(OPTIONS); } widgDisplayScreen(psWScreen); // show the widgets currently running diff --git a/src/frontend.h b/src/frontend.h index aecb290a6..e79f6f2f8 100644 --- a/src/frontend.h +++ b/src/frontend.h @@ -54,8 +54,7 @@ typedef enum _title_mode { } tMode; extern tMode titleMode; // the global case - -extern bool multiplayersetup; +extern tMode lastTitleMode; #define DEFAULT_LEVEL "CAM_1A" #define TUTORIAL_LEVEL "TUTORIAL3" diff --git a/src/multiint.c b/src/multiint.c index 367f4318a..5b53d47b1 100644 --- a/src/multiint.c +++ b/src/multiint.c @@ -889,6 +889,11 @@ FAIL: iV_SetFont(font_large); iV_DrawText(_("Searching"), D_W+260, D_H+460); } + + if (CancelPressed()) + { + changeTitleMode(PROTOCOL); + } } // Used to draw the password box for the lobby screen @@ -2216,14 +2221,7 @@ static void stopJoining(void) return; } debug(LOG_NET, "We have stopped joining."); - if (multiplayersetup) - { - changeTitleMode(MULTI); - } - else - { - changeTitleMode(SINGLE); - } + changeTitleMode(lastTitleMode); selectedPlayer = 0; if (ingame.bHostSetup) @@ -3148,14 +3146,7 @@ void runMultiOptions(void) if (CancelPressed()) { - if (multiplayersetup) - { - changeTitleMode(MULTI); - } - else - { - changeTitleMode(SINGLE); - } + changeTitleMode(lastTitleMode); } }