diff --git a/src/d_clisrv.c b/src/d_clisrv.c index d17bad55f..779e3e330 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1609,8 +1609,8 @@ static boolean SL_InsertServer(serverinfo_pak* info, SINT8 node) if (strcmp(info->application, SRB2APPLICATION)) return false;/* that's a different mod */ - if (!server && info->modifiedgame != (mpmenu.room == 1)) - return false;/* CORE vs MODDED! Unless we ARE the server (i.e. local play), then it's fine to not match. */ + if (serverlistultimatecount && info->modifiedgame != (mpmenu.room == 1)) + return false;/* CORE vs MODDED! But only on the server browser page. */ i = serverlistcount++; } @@ -2723,28 +2723,22 @@ static void Command_connect(void) // we don't request a restart unless the filelist differs server = false; -/* - if (!stricmp(COM_Argv(1), "self")) - { - servernode = 0; - server = true; - /// \bug should be but... - //SV_SpawnServer(); - } - else -*/ + + // Get the server node. + if (netgame) { // used in menu to connect to a server in the list - if (netgame && !stricmp(COM_Argv(1), "node")) + if (stricmp(COM_Argv(1), "node") != 0) { - servernode = (SINT8)atoi(COM_Argv(2)); - } - else if (netgame) - { - CONS_Printf(M_GetText("You cannot connect while in a game. End this game first.\n")); + CONS_Printf(M_GetText("You cannot connect via address while joining a server.\n")); return; } - else if (I_NetOpenSocket) + servernode = (SINT8)atoi(COM_Argv(2)); + } + else + { + // Standard behaviour + if (I_NetOpenSocket) { I_NetOpenSocket(); netgame = true; @@ -2771,7 +2765,10 @@ static void Command_connect(void) } } else + { CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n")); + return; + } } if (splitscreen != cv_splitplayers.value-1) @@ -4658,8 +4655,13 @@ static void HandleServerInfo(SINT8 node) CopyCaretColors(netbuffer->u.serverinfo.servername, servername, MAXSERVERNAME); // If we have cause to reject it, it's not worth observing. - if (SL_InsertServer(&netbuffer->u.serverinfo, node) == false) + if ( + SL_InsertServer(&netbuffer->u.serverinfo, node) == false + && serverlistultimatecount + ) + { serverlistultimatecount--; + } } static void PT_WillResendGamestate(void) diff --git a/src/d_main.c b/src/d_main.c index a3347dc90..4f88b2538 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -963,6 +963,7 @@ void D_ClearState(void) // (otherwise the game still thinks we're playing!) SV_StopServer(); SV_ResetServer(); + serverlistultimatecount = 0; for (i = 0; i < MAXPLAYERS; i++) CL_ClearPlayer(i); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 41c6c4fda..f60b07c90 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2320,9 +2320,17 @@ static void Command_Map_f(void) INT32 newgametype = gametype; boolean newencoremode = (cv_kartencore.value == 1); - if (client && !IsPlayerAdmin(consoleplayer)) + if (Playing()) { - CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); + if (client && !IsPlayerAdmin(consoleplayer)) + { + CONS_Printf(M_GetText("Only the server or a remote admin can use this.\n")); + return; + } + } + else if (netgame) + { + CONS_Printf(M_GetText("You cannot start a session while joining a server.\n")); return; } diff --git a/src/menus/play-online-server-browser.c b/src/menus/play-online-server-browser.c index 29c2e4379..ce6571d86 100644 --- a/src/menus/play-online-server-browser.c +++ b/src/menus/play-online-server-browser.c @@ -13,6 +13,13 @@ void M_ServerListFillDebug(void); #endif +// Quit +static boolean M_ServerBrowserQuit(void) +{ + serverlistultimatecount = 0; + return true; +} + menuitem_t PLAY_MP_ServerBrowser[] = { @@ -38,7 +45,7 @@ menu_t PLAY_MP_ServerBrowserDef = { M_DrawMPServerBrowser, M_MPServerBrowserTick, NULL, - NULL, + M_ServerBrowserQuit, M_ServerBrowserInputs };