Hopefully a few more fixes and sanity changes for map voting

This commit is contained in:
Sryder 2018-02-23 01:53:30 +00:00
parent 387f6b904c
commit 0454293bae

View file

@ -1956,12 +1956,10 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
void D_SetupVote(void) void D_SetupVote(void)
{ {
XBOXSTATIC char buf[8]; char buf[8];
char *p; char *p = buf;
INT32 i; INT32 i;
p = buf;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (i == 3) if (i == 3)
@ -1975,16 +1973,19 @@ void D_SetupVote(void)
void D_ModifyClientVote(SINT8 voted) void D_ModifyClientVote(SINT8 voted)
{ {
XBOXSTATIC UINT8 buf[1]; char buf[1];
buf[0] = (UINT8)(voted+1); char *p = buf;
WRITESINT8(p, voted);
SendNetXCmd(XD_MODIFYVOTE, &buf, 1); SendNetXCmd(XD_MODIFYVOTE, &buf, 1);
} }
void D_PickVote(void) void D_PickVote(void)
{ {
XBOXSTATIC UINT8 buf[2]; char buf[2];
UINT8 temppicks[MAXPLAYERS]; char* p = buf;
UINT8 templevels[MAXPLAYERS]; SINT8 temppicks[MAXPLAYERS];
SINT8 templevels[MAXPLAYERS];
UINT8 numvotes = 0, key = 0; UINT8 numvotes = 0, key = 0;
INT32 i; INT32 i;
@ -1994,16 +1995,16 @@ void D_PickVote(void)
continue; continue;
if (votes[i] != -1) if (votes[i] != -1)
{ {
temppicks[numvotes] = (UINT8)i; temppicks[numvotes] = i;
templevels[numvotes] = (UINT8)votes[i]; templevels[numvotes] = votes[i];
numvotes++; numvotes++;
} }
} }
key = M_RandomKey(numvotes); key = M_RandomKey(numvotes);
buf[0] = temppicks[key]; WRITESINT8(p, temppicks[key]);
buf[1] = templevels[key]; WRITESINT8(p, templevels[key]);
SendNetXCmd(XD_PICKVOTE, &buf, 2); SendNetXCmd(XD_PICKVOTE, &buf, 2);
} }
@ -4600,7 +4601,7 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum) static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum)
{ {
SINT8 voted = READSINT8(*cp); SINT8 voted = READSINT8(*cp);
votes[playernum] = (SINT8)(voted-1); votes[playernum] = voted;
} }
static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
@ -4622,7 +4623,7 @@ static void Got_PickVotecmd(UINT8 **cp, INT32 playernum)
return; return;
} }
Y_SetupVoteFinish((SINT8)pick, (SINT8)level); Y_SetupVoteFinish(pick, level);
} }
/** Prints the number of the displayplayer. /** Prints the number of the displayplayer.