diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 1e5787583..4da5f40b1 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -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)) { diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 76a001544..8c4ecc121 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -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)<string); + V_DrawFixedPatch((xp + 12)<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) diff --git a/src/m_misc.c b/src/m_misc.c index 0628ef3b6..796fcb90d 100644 --- a/src/m_misc.c +++ b/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++; }