Seperate out K_SendCallMidVote from Command_CallVote

This commit is contained in:
toaster 2023-06-27 17:33:01 +01:00
parent 15ff670a48
commit 8a4cca8518

View file

@ -151,9 +151,6 @@ static boolean K_MidVoteTypeUsesVictim(midVoteType_e voteType)
--------------------------------------------------*/ --------------------------------------------------*/
static void Command_CallVote(void) static void Command_CallVote(void)
{ {
UINT8 buf[MAXTEXTCMD];
UINT8 *buf_p = buf;
size_t numArgs = 0; size_t numArgs = 0;
const char *voteTypeStr = NULL; const char *voteTypeStr = NULL;
@ -162,8 +159,6 @@ static void Command_CallVote(void)
const char *voteVariableStr = NULL; const char *voteVariableStr = NULL;
INT32 voteVariable = 0; INT32 voteVariable = 0;
player_t *victim = NULL;
INT32 i = INT32_MAX; INT32 i = INT32_MAX;
if (netgame == false) if (netgame == false)
@ -210,11 +205,26 @@ static void Command_CallVote(void)
break; break;
} }
} }
}
}
if (voteVariable >= 0 && voteVariable < MAXPLAYERS) K_SendCallMidVote(voteType, voteVariable);
{ }
victim = &players[voteVariable];
} /*--------------------------------------------------
void K_SendCallMidVote(midVoteType_e voteType, INT32 voteVariable)
See header file for description.
--------------------------------------------------*/
void K_SendCallMidVote(midVoteType_e voteType, INT32 voteVariable)
{
player_t *victim = NULL;
if (K_MidVoteTypeUsesVictim(voteType) == true)
{
if (voteVariable >= 0 && voteVariable < MAXPLAYERS)
{
victim = &players[voteVariable];
} }
} }
@ -224,6 +234,9 @@ static void Command_CallVote(void)
return; return;
} }
UINT8 buf[MAXTEXTCMD];
UINT8 *buf_p = buf;
WRITEUINT8(buf_p, voteType); WRITEUINT8(buf_p, voteType);
WRITEINT32(buf_p, voteVariable); WRITEINT32(buf_p, voteVariable);