mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Clean up recent IP handling a bunch.
This commit is contained in:
parent
794385dd63
commit
e1c8f8095b
3 changed files with 29 additions and 17 deletions
|
|
@ -2094,10 +2094,10 @@ 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 && strlen(joinedIP)) // false if we have "" which is \0
|
||||
if (joinedIP[0]) // 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.
|
||||
joinedIP[0] = '\0'; // And empty this for good measure regardless of whether or not we actually used it.
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -2387,7 +2387,7 @@ static void Command_connect(void)
|
|||
{
|
||||
|
||||
// By default, clear the saved address that we'd save after succesfully joining just to be sure:
|
||||
strcpy(joinedIP, "");
|
||||
joinedIP[0] = '\0';
|
||||
|
||||
if (COM_Argc() < 2 || *COM_Argv(1) == 0)
|
||||
{
|
||||
|
|
@ -3905,7 +3905,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....)
|
||||
joinedIP[0] = '\0'; // 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) || (bossinfo.boss == true))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2339,7 +2339,7 @@ void M_DrawMPHost(void)
|
|||
case IT_CV_STRING:
|
||||
V_DrawThinString(xp + 96, yp, V_ALLOWLOWERCASE|V_6WIDTHSPACE, cv->string);
|
||||
if (skullAnimCounter < 4 && i == itemOn)
|
||||
V_DrawString(xp + 94 + V_ThinStringWidth(cv->string, V_6WIDTHSPACE), yp+1, 0, "_");
|
||||
V_DrawString(xp + 96 + V_ThinStringWidth(cv->string, V_ALLOWLOWERCASE|V_6WIDTHSPACE), yp+1, 0, "_");
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -2404,15 +2404,20 @@ void M_DrawMPJoinIP(void)
|
|||
if (currentMenu->numitems - i <= NUMLOGIP)
|
||||
{
|
||||
UINT8 index = NUMLOGIP - (currentMenu->numitems - i);
|
||||
if (strlen(joinedIPlist[index][1])) // Try drawing server name
|
||||
if (index == 0)
|
||||
{
|
||||
xp += 8;
|
||||
}
|
||||
|
||||
if (joinedIPlist[index][1][0]) // Try drawing server name
|
||||
strcpy(str, joinedIPlist[index][1]);
|
||||
else if (strlen(joinedIPlist[index][0])) // If that fails, get the address
|
||||
else if (joinedIPlist[index][0][0]) // If that fails, get the address
|
||||
strcpy(str, joinedIPlist[index][0]);
|
||||
else
|
||||
strcpy(str, "---"); // If that fails too then there's nothing!
|
||||
}
|
||||
|
||||
V_DrawString(xp, yp, V_ALLOWLOWERCASE | ((i == itemOn || currentMenu->menuitems[i].status & IT_SPACE) ? highlightflags : 0), str);
|
||||
V_DrawThinString(xp, yp, V_ALLOWLOWERCASE | ((i == itemOn || currentMenu->menuitems[i].status & IT_SPACE) ? highlightflags : 0)|V_ALLOWLOWERCASE|V_6WIDTHSPACE, str);
|
||||
|
||||
// Cvar specific handling
|
||||
switch (currentMenu->menuitems[i].status & IT_TYPE)
|
||||
|
|
@ -2427,10 +2432,10 @@ void M_DrawMPJoinIP(void)
|
|||
//colormap = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_MOSS, GTC_CACHE);
|
||||
colormapc = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PLAGUE, GTC_CACHE);
|
||||
|
||||
V_DrawFixedPatch((xp + 20)<<FRACBITS, (yp-3)<<FRACBITS, FRACUNIT, 0, typebar, colormapc); // Always consider that this is selected otherwise it clashes.
|
||||
V_DrawThinString(xp + 26, yp-1, V_ALLOWLOWERCASE, cv->string);
|
||||
V_DrawFixedPatch((xp + 12)<<FRACBITS, (yp-2)<<FRACBITS, FRACUNIT, 0, typebar, colormapc); // Always consider that this is selected otherwise it clashes.
|
||||
V_DrawThinString(xp + 18, yp, V_ALLOWLOWERCASE|V_6WIDTHSPACE, cv->string);
|
||||
if (skullAnimCounter < 4 && i == itemOn)
|
||||
V_DrawCharacter(xp + 24 + V_ThinStringWidth(cv->string, 0), yp, '_' | 0x80, false);
|
||||
V_DrawString(xp + 18 + V_ThinStringWidth(cv->string, V_ALLOWLOWERCASE|V_6WIDTHSPACE), yp+1, 0, "_");
|
||||
|
||||
/*// On this specific menu the only time we'll ever see this is for the connect by IP typefield.
|
||||
// Draw the small GO button here (and the text which is a separate graphic)
|
||||
|
|
|
|||
19
src/m_misc.c
19
src/m_misc.c
|
|
@ -190,8 +190,7 @@ void M_InitJoinedIPArray(void)
|
|||
UINT8 i;
|
||||
for (i=0; i < NUMLOGIP; i++)
|
||||
{
|
||||
strcpy(joinedIPlist[i][0], "");
|
||||
strcpy(joinedIPlist[i][1], "");
|
||||
joinedIPlist[i][0][0] = joinedIPlist[i][1][0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -564,10 +563,18 @@ void M_LoadJoinedIPs(void)
|
|||
|
||||
s = strtok(NULL, IPLOGFILESEP); // Let's get rid of this awful \n while we're here!
|
||||
|
||||
if (strlen(s))
|
||||
s[strlen(s)-1] = '\0'; // Remove the \n
|
||||
|
||||
strcpy(joinedIPlist[i][1], s);
|
||||
if (s)
|
||||
{
|
||||
//strcpy(joinedIPlist[i][1], s); -- get rid of \n too...
|
||||
char *c = joinedIPlist[i][1];
|
||||
while (*s && *s != '\n')
|
||||
{
|
||||
*c = *s;
|
||||
s++;
|
||||
c++;
|
||||
}
|
||||
*c = '\0';
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue