Merge branch 'connecting-conundrums' into 'master'

Connecting Conundrums

See merge request KartKrew/Kart!1453
This commit is contained in:
Sal 2023-09-08 02:05:09 +00:00
commit eff847b216
4 changed files with 41 additions and 23 deletions

View file

@ -1609,8 +1609,8 @@ static boolean SL_InsertServer(serverinfo_pak* info, SINT8 node)
if (strcmp(info->application, SRB2APPLICATION)) if (strcmp(info->application, SRB2APPLICATION))
return false;/* that's a different mod */ return false;/* that's a different mod */
if (!server && info->modifiedgame != (mpmenu.room == 1)) if (serverlistultimatecount && 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. */ return false;/* CORE vs MODDED! But only on the server browser page. */
i = serverlistcount++; i = serverlistcount++;
} }
@ -2723,28 +2723,22 @@ static void Command_connect(void)
// we don't request a restart unless the filelist differs // we don't request a restart unless the filelist differs
server = false; server = false;
/*
if (!stricmp(COM_Argv(1), "self")) // Get the server node.
{ if (netgame)
servernode = 0;
server = true;
/// \bug should be but...
//SV_SpawnServer();
}
else
*/
{ {
// used in menu to connect to a server in the list // 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)); CONS_Printf(M_GetText("You cannot connect via address while joining a server.\n"));
}
else if (netgame)
{
CONS_Printf(M_GetText("You cannot connect while in a game. End this game first.\n"));
return; return;
} }
else if (I_NetOpenSocket) servernode = (SINT8)atoi(COM_Argv(2));
}
else
{
// Standard behaviour
if (I_NetOpenSocket)
{ {
I_NetOpenSocket(); I_NetOpenSocket();
netgame = true; netgame = true;
@ -2771,7 +2765,10 @@ static void Command_connect(void)
} }
} }
else else
{
CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n")); CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n"));
return;
}
} }
if (splitscreen != cv_splitplayers.value-1) if (splitscreen != cv_splitplayers.value-1)
@ -4658,8 +4655,13 @@ static void HandleServerInfo(SINT8 node)
CopyCaretColors(netbuffer->u.serverinfo.servername, servername, MAXSERVERNAME); CopyCaretColors(netbuffer->u.serverinfo.servername, servername, MAXSERVERNAME);
// If we have cause to reject it, it's not worth observing. // 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--; serverlistultimatecount--;
}
} }
static void PT_WillResendGamestate(void) static void PT_WillResendGamestate(void)

View file

@ -963,6 +963,7 @@ void D_ClearState(void)
// (otherwise the game still thinks we're playing!) // (otherwise the game still thinks we're playing!)
SV_StopServer(); SV_StopServer();
SV_ResetServer(); SV_ResetServer();
serverlistultimatecount = 0;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
CL_ClearPlayer(i); CL_ClearPlayer(i);

View file

@ -2320,9 +2320,17 @@ static void Command_Map_f(void)
INT32 newgametype = gametype; INT32 newgametype = gametype;
boolean newencoremode = (cv_kartencore.value == 1); 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; return;
} }

View file

@ -13,6 +13,13 @@
void M_ServerListFillDebug(void); void M_ServerListFillDebug(void);
#endif #endif
// Quit
static boolean M_ServerBrowserQuit(void)
{
serverlistultimatecount = 0;
return true;
}
menuitem_t PLAY_MP_ServerBrowser[] = menuitem_t PLAY_MP_ServerBrowser[] =
{ {
@ -38,7 +45,7 @@ menu_t PLAY_MP_ServerBrowserDef = {
M_DrawMPServerBrowser, M_DrawMPServerBrowser,
M_MPServerBrowserTick, M_MPServerBrowserTick,
NULL, NULL,
NULL, M_ServerBrowserQuit,
M_ServerBrowserInputs M_ServerBrowserInputs
}; };