Added a bit of a fun limitation.

* Made it so (player->availabilities & 1 << skinnum) is only true if skins[skinnum] DOES have an availability method, and always false otherwise.
* This means that setting your availabilities to INT32_MAX is no longer the equivalent of having gotten all skins.
* This means we can detect and kick cheat engine script kiddies who try to fool the server that they can use everything.
* This means availabilities of 0x00 is now valid, so make it all F's for an invalid not-in-game.
This commit is contained in:
toasterbabe 2017-03-18 13:03:29 +00:00
parent ced6cd4349
commit 096921cbbf
3 changed files with 14 additions and 4 deletions

View File

@ -1366,8 +1366,7 @@ static boolean SV_SendServerConfig(INT32 node)
// which is nice and easy for us to detect
memset(netbuffer->u.servercfg.playerskins, 0xFF, sizeof(netbuffer->u.servercfg.playerskins));
memset(netbuffer->u.servercfg.playercolor, 0xFF, sizeof(netbuffer->u.servercfg.playercolor));
// ...except for availabilities, where 00 is nonexistent
memset(netbuffer->u.servercfg.playeravailabilities, 0x00, sizeof(netbuffer->u.servercfg.playeravailabilities));
memset(netbuffer->u.servercfg.playeravailabilities, 0xFF, sizeof(netbuffer->u.servercfg.playeravailabilities));
for (i = 0; i < MAXPLAYERS; i++)
{
@ -3498,7 +3497,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
{
if (netbuffer->u.servercfg.playerskins[j] == 0xFF
&& netbuffer->u.servercfg.playercolor[j] == 0xFF
&& netbuffer->u.servercfg.playeravailabilities[j] == 0x00)
&& netbuffer->u.servercfg.playeravailabilities[j] == 0xFFFFFFFF)
continue; // not in game
playeringame[j] = true;

View File

@ -1329,6 +1329,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (server && (p != &players[consoleplayer] && p != &players[secondarydisplayplayer]))
{
boolean kick = false;
INT32 s;
// team colors
if (G_GametypeHasTeams())
@ -1343,6 +1344,16 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
if (!p->skincolor)
kick = true;
// availabilities
for (s = 0; s < MAXSKINS; s++)
{
if (!skins[s].availability && (p->availabilities & (1 << s)))
{
kick = true;
break;
}
}
if (kick)
{
XBOXSTATIC UINT8 buf[2];

View File

@ -2561,7 +2561,7 @@ UINT32 R_GetSkinAvailabilities(void)
for (s = 0; s < MAXSKINS; s++)
{
if (!skins[s].availability || unlockables[skins[s].availability - 1].unlocked)
if (skins[s].availability && unlockables[skins[s].availability - 1].unlocked)
response |= (1 << s);
}
return response;