No more magic numbers

This commit is contained in:
Prisima the Fox 2016-10-21 16:16:54 -04:00
parent defc7c1645
commit 6733152651

View file

@ -2517,7 +2517,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
INT32 pnum, msg; INT32 pnum, msg;
XBOXSTATIC char buf[3 + MAX_REASONLENGTH]; XBOXSTATIC char buf[3 + MAX_REASONLENGTH];
char *reason = buf; char *reason = buf;
INT32 kickreason = 1; kickreason_t kickreason = KR_KICK;
pnum = READUINT8(*p); pnum = READUINT8(*p);
msg = READUINT8(*p); msg = READUINT8(*p);
@ -2598,17 +2598,17 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
{ {
case KICK_MSG_GO_AWAY: case KICK_MSG_GO_AWAY:
CONS_Printf(M_GetText("has been kicked (Go away)\n")); CONS_Printf(M_GetText("has been kicked (Go away)\n"));
kickreason = 1; kickreason = KR_KICK;
break; break;
#ifdef NEWPING #ifdef NEWPING
case KICK_MSG_PING_HIGH: case KICK_MSG_PING_HIGH:
CONS_Printf(M_GetText("left the game (Broke ping limit)\n")); CONS_Printf(M_GetText("left the game (Broke ping limit)\n"));
kickreason = 2; kickreason = KR_PINGLIMIT;
break; break;
#endif #endif
case KICK_MSG_CON_FAIL: case KICK_MSG_CON_FAIL:
CONS_Printf(M_GetText("left the game (Synch failure)\n")); CONS_Printf(M_GetText("left the game (Synch failure)\n"));
kickreason = 3; kickreason = KR_SYNCH;
if (M_CheckParm("-consisdump")) // Helps debugging some problems if (M_CheckParm("-consisdump")) // Helps debugging some problems
{ {
@ -2645,26 +2645,26 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
break; break;
case KICK_MSG_TIMEOUT: case KICK_MSG_TIMEOUT:
CONS_Printf(M_GetText("left the game (Connection timeout)\n")); CONS_Printf(M_GetText("left the game (Connection timeout)\n"));
kickreason = 4; kickreason = KR_TIMEOUT;
break; break;
case KICK_MSG_PLAYER_QUIT: case KICK_MSG_PLAYER_QUIT:
if (netgame) // not splitscreen/bots if (netgame) // not splitscreen/bots
CONS_Printf(M_GetText("left the game\n")); CONS_Printf(M_GetText("left the game\n"));
kickreason = 6; kickreason = KR_LEAVE;
break; break;
case KICK_MSG_BANNED: case KICK_MSG_BANNED:
CONS_Printf(M_GetText("has been banned (Don't come back)\n")); CONS_Printf(M_GetText("has been banned (Don't come back)\n"));
kickreason = 5; kickreason = KR_BAN;
break; break;
case KICK_MSG_CUSTOM_KICK: case KICK_MSG_CUSTOM_KICK:
READSTRINGN(*p, reason, MAX_REASONLENGTH+1); READSTRINGN(*p, reason, MAX_REASONLENGTH+1);
CONS_Printf(M_GetText("has been kicked (%s)\n"), reason); CONS_Printf(M_GetText("has been kicked (%s)\n"), reason);
kickreason = 1; kickreason = KR_KICK;
break; break;
case KICK_MSG_CUSTOM_BAN: case KICK_MSG_CUSTOM_BAN:
READSTRINGN(*p, reason, MAX_REASONLENGTH+1); READSTRINGN(*p, reason, MAX_REASONLENGTH+1);
CONS_Printf(M_GetText("has been banned (%s)\n"), reason); CONS_Printf(M_GetText("has been banned (%s)\n"), reason);
kickreason = 5; kickreason = KR_BAN;
break; break;
} }