Don't kick Tails!

Also, a movement for the WRITESINT8 to prevent modification to buf if the function bails early.
This commit is contained in:
toasterbabe 2017-07-05 16:20:23 +01:00
parent b37d09df5f
commit 60e21381ab
1 changed files with 8 additions and 1 deletions

View File

@ -2587,6 +2587,9 @@ static void Command_Kick(void)
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
UINT8 *p = buf;
if (!netgame) // Don't kick Tails in splitscreen!
return;
if (COM_Argc() == 1)
{
CONS_Printf(M_GetText("kick <playername/playernum> <reason>: kick a player\n"));
@ -2596,9 +2599,10 @@ static void Command_Kick(void)
if (server || adminplayer == consoleplayer)
{
const SINT8 pn = nametonum(COM_Argv(1));
WRITESINT8(p, pn);
if (pn == -1 || pn == 0)
return;
// Special case if we are trying to kick a player who is downloading the game state:
// trigger a timeout instead of kicking them, because a kick would only
// take effect after they have finished downloading
@ -2607,6 +2611,9 @@ static void Command_Kick(void)
Net_ConnectionTimeout(playernode[pn]);
return;
}
WRITESINT8(p, pn);
if (COM_Argc() == 2)
{
WRITEUINT8(p, KICK_MSG_GO_AWAY);