From b750ef11dd1d40b2ebb42a0e0bd4b6ec72b50b12 Mon Sep 17 00:00:00 2001 From: SinnamonLat Date: Wed, 17 Nov 2021 14:21:29 +0100 Subject: [PATCH] Make sure we don't save IPs when hosting games... --- src/d_clisrv.c | 3 ++- src/k_menufunc.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index c0305d8bd..a9576bdcf 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2077,7 +2077,7 @@ static void CL_ConnectToServer(void) // @TODO: Save the proper server name, right now it doesn't seem like we can consistently retrieve it from the serverlist....? // It works... sometimes but not always which is weird. - if (*joinedIP) // false if we have "" which is \0 + if (*joinedIP && strlen(joinedIP)) // false if we have "" which is \0 M_AddToJoinedIPs(joinedIP, netbuffer->u.serverinfo.servername); strcpy(joinedIP, ""); // And empty this for good measure regardless of whether or not we actually used it. @@ -3757,6 +3757,7 @@ void SV_StartSinglePlayerServer(void) server = true; netgame = false; multiplayer = false; + strcpy(joinedIP, ""); // Make sure to empty this so that we don't save garbage when we start our own game. (because yes we use this for netgames too....) if (modeattacking == ATTACKING_CAPSULES) { diff --git a/src/k_menufunc.c b/src/k_menufunc.c index b5b9ea305..6c25233bd 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -928,16 +928,16 @@ boolean M_Responder(event_t *ev) routine(ch); return true; } - + // Handle menu-specific input handling. If this returns true we skip regular input handling. if (currentMenu->inputroutine) { INT32 res = 0; if (shiftdown && ch >= 32 && ch <= 127) ch = shiftxform[ch]; - + res = currentMenu->inputroutine(ch); - + if (res) return true; } @@ -2780,24 +2780,24 @@ boolean M_JoinIPInputs(INT32 ch) UINT16 i; for (i=0; i < strlen(paste); i++) M_ChangeStringCvar(paste[i]); // We can afford to do this since we're currently on that cvar. - + return true; // Don't input the V obviously lol. } - + } else if (currentMenu->numitems - itemOn <= NUMLOGIP && ch == KEY_ENTER) // On one of the last 3 options for IP rejoining { UINT8 index = NUMLOGIP - (currentMenu->numitems - itemOn); - + // Is there an address at this part of the table? if (joinedIPlist[index][0] && strlen(joinedIPlist[index][0])) M_JoinIP(joinedIPlist[index][0]); else S_StartSound(NULL, sfx_lose); - + return true; // eat input. } - + return false; }