From ef1aeb2ff6d17c64dcd221e2bbb4a09fd9ad5c5a Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 19 Nov 2019 13:36:33 +0000 Subject: [PATCH] MS Info packet tweaks. * Report a completely uppercase map title in SERVERINFO, as per the MS previously expected (resolves #300). * Ignore colour codes in map titles in SERVERINFO, since those now function like with console font. * Modulo the skin number provided in PLAYERINFO by 3 in DEVELOP builds, so it's safe to test with certain characters on the MS (AS LONG AS IT'S NOT A RELEASE BUILD). --- src/d_clisrv.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index aca37df1d..ece74ed4b 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1302,7 +1302,19 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime) M_Memcpy(netbuffer->u.serverinfo.mapmd5, mapmd5, 16); if (strcmp(mapheaderinfo[gamemap-1]->lvlttl, "")) - strncpy(netbuffer->u.serverinfo.maptitle, (char *)mapheaderinfo[gamemap-1]->lvlttl, 33); + { + char *read = mapheaderinfo[gamemap-1]->lvlttl, *writ = netbuffer->u.serverinfo.maptitle; + while (*read != '\0' && (read-mapheaderinfo[gamemap-1]->lvlttl) < 33) + { + if (!(*read & 0x80)) + { + *writ = toupper(*read); + writ++; + } + read++; + } + //strncpy(netbuffer->u.serverinfo.maptitle, (char *)mapheaderinfo[gamemap-1]->lvlttl, 33); + } else strncpy(netbuffer->u.serverinfo.maptitle, "UNKNOWN", 33); @@ -1358,7 +1370,11 @@ static void SV_SendPlayerInfo(INT32 node) netbuffer->u.playerinfo[i].score = LONG(players[i].score); netbuffer->u.playerinfo[i].timeinserver = SHORT((UINT16)(players[i].jointime / TICRATE)); - netbuffer->u.playerinfo[i].skin = (UINT8)players[i].skin; + netbuffer->u.playerinfo[i].skin = (UINT8)(players[i].skin +#ifdef DEVELOP // it's safe to do this only because PLAYERINFO isn't read by the game itself + % 3 +#endif + ); // Extra data netbuffer->u.playerinfo[i].data = 0; //players[i].skincolor;