Make sure we don't save IPs when hosting games...

This commit is contained in:
SinnamonLat 2021-11-17 14:21:29 +01:00
parent 88aec4e7db
commit b750ef11dd
2 changed files with 10 additions and 9 deletions

View file

@ -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)
{

View file

@ -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;
}