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).
This commit is contained in:
toaster 2019-11-19 13:36:33 +00:00
parent fe1bb6f716
commit ef1aeb2ff6
1 changed files with 18 additions and 2 deletions

View File

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