From 71dea0161d6d04dd856850675c2fa4c7194cc9f5 Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 18 Dec 2023 14:15:01 +0300 Subject: [PATCH] Only warn about custom master server when failed to connect to it --- src/m_menu.c | 32 ++++++++++++++++++++------------ src/m_menu.h | 4 ++++ src/mserv.c | 2 +- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index fe7b9b99b..5a29186d1 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10824,6 +10824,12 @@ static void M_ConnectMenuModChecks(INT32 choice) boolean firstDismissedNagThisBoot = true; #ifdef MASTERSERVER + +enum { + CONNECT_MENU, + STARTSERVER_MENU, +} connect_error_continue = CONNECT_MENU; + static void M_HandleMasterServerResetChoice(event_t *ev) { INT32 choice = -1; @@ -10852,6 +10858,18 @@ static void M_HandleMasterServerResetChoice(event_t *ev) } } + +void M_PopupMasterServerConnectError(void) +{ + if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) + { + M_StartMessage(M_GetText("There was a problem connecting to\ncustom Master Server\n\nYou've changed the Server Browser address.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\n"), connect_error_continue == STARTSERVER_MENU ? M_PreStartServerMenuChoice : M_PreConnectMenuChoice,MM_EVENTHANDLER); + } + else + { + M_StartMessage(M_GetText("There was a problem connecting to\nthe Master Server\n\nCheck the console for details.\n"), NULL, MM_NOTHING); + } +} #endif static void M_PreStartServerMenu(INT32 choice) @@ -10859,11 +10877,7 @@ static void M_PreStartServerMenu(INT32 choice) (void)choice; #ifdef MASTERSERVER - if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) - { - M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to host games on the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreStartServerMenuChoice,MM_EVENTHANDLER); - return; - } + connect_error_continue = STARTSERVER_MENU; #endif M_StartServerMenu(-1); @@ -10872,13 +10886,7 @@ static void M_PreStartServerMenu(INT32 choice) static void M_PreConnectMenu(INT32 choice) { (void)choice; - - if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) - { - M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to see games from the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreConnectMenuChoice,MM_EVENTHANDLER); - return; - } - + connect_error_continue = CONNECT_MENU; M_ConnectMenuModChecks(-1); } diff --git a/src/m_menu.h b/src/m_menu.h index e3b042294..8d1ebb723 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -285,6 +285,10 @@ INT32 HU_GetHighlightColor(void); void M_PopupMasterServerRules(void); +#ifdef MASTERSERVER +void M_PopupMasterServerConnectError(void); +#endif + // These defines make it a little easier to make menus #define DEFAULTMENUSTYLE(header, source, prev, x, y)\ {\ diff --git a/src/mserv.c b/src/mserv.c index 6945154c4..3b5d84b46 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -140,7 +140,7 @@ static void WarnGUI (void) #ifdef HAVE_THREADS I_lock_mutex(&m_menu_mutex); #endif - M_StartMessage(M_GetText("There was a problem connecting to\nthe Master Server\n\nCheck the console for details.\n"), NULL, MM_NOTHING); + M_PopupMasterServerConnectError(); #ifdef HAVE_THREADS I_unlock_mutex(m_menu_mutex); #endif