From 8a4cca8518de90a97c170ad9f4198ed7cf6d1b4c Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 27 Jun 2023 17:33:01 +0100 Subject: [PATCH] Seperate out K_SendCallMidVote from Command_CallVote --- src/k_zvote.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/k_zvote.c b/src/k_zvote.c index b0d1991b6..94fffb720 100644 --- a/src/k_zvote.c +++ b/src/k_zvote.c @@ -151,9 +151,6 @@ static boolean K_MidVoteTypeUsesVictim(midVoteType_e voteType) --------------------------------------------------*/ static void Command_CallVote(void) { - UINT8 buf[MAXTEXTCMD]; - UINT8 *buf_p = buf; - size_t numArgs = 0; const char *voteTypeStr = NULL; @@ -162,8 +159,6 @@ static void Command_CallVote(void) const char *voteVariableStr = NULL; INT32 voteVariable = 0; - player_t *victim = NULL; - INT32 i = INT32_MAX; if (netgame == false) @@ -210,11 +205,26 @@ static void Command_CallVote(void) break; } } + } + } - if (voteVariable >= 0 && voteVariable < MAXPLAYERS) - { - victim = &players[voteVariable]; - } + K_SendCallMidVote(voteType, 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; } + UINT8 buf[MAXTEXTCMD]; + UINT8 *buf_p = buf; + WRITEUINT8(buf_p, voteType); WRITEINT32(buf_p, voteVariable);