Make a server report its preferred gametype on the MS listing, not its current one.

The intent is to stop servers from needing to dedicate their limited name/MOTD space to things like advertising `lessbattlevotes`, and to avoid "punishing" a server in visibility for allowing temporary gametype switches. However, this is possibly a controversial change, so I'm doing it in its own commit in case there's a clear consensus to revert.
This commit is contained in:
toaster 2022-05-27 23:21:25 +01:00
parent 7e7bd7dbb2
commit 77f2894bc3

View file

@ -1478,6 +1478,9 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
UINT8 *p; UINT8 *p;
size_t mirror_length; size_t mirror_length;
const char *httpurl = cv_httpsource.string; const char *httpurl = cv_httpsource.string;
UINT8 gt = (cv_kartgametypepreference.value == -1)
? gametype
: cv_kartgametypepreference.value;
netbuffer->packettype = PT_SERVERINFO; netbuffer->packettype = PT_SERVERINFO;
netbuffer->u.serverinfo._255 = 255; netbuffer->u.serverinfo._255 = 255;
@ -1492,7 +1495,10 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers(); netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value)); netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
netbuffer->u.serverinfo.gametype = (UINT8)(G_BattleGametype() ? VANILLA_GT_MATCH : VANILLA_GT_RACE); // SRB2Kart: Vanilla's gametype constants for MS support
// SRB2Kart: Vanilla's gametype constants for MS support
netbuffer->u.serverinfo.gametype = (UINT8)((gt == GT_MATCH) ? VANILLA_GT_MATCH : VANILLA_GT_RACE);
netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame; netbuffer->u.serverinfo.modifiedgame = (UINT8)modifiedgame;
netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled(); netbuffer->u.serverinfo.cheatsenabled = CV_CheatsEnabled();