Attempted to fix how voting handles no votes

I don't know exactly what it did previously since I never actually
observed what happens, but now in dedicated servers it will wait for
time to run out, then if there's no votes by that time it will just go
onto nextlevel
This commit is contained in:
TehRealSalt 2018-03-01 17:05:36 -05:00
parent a51663da6f
commit ce74a4c964
2 changed files with 32 additions and 6 deletions

View file

@ -2003,8 +2003,16 @@ void D_PickVote(void)
key = M_RandomKey(numvotes);
WRITESINT8(p, temppicks[key]);
WRITESINT8(p, templevels[key]);
if (numvotes > 0)
{
WRITESINT8(p, temppicks[key]);
WRITESINT8(p, templevels[key]);
}
else
{
WRITESINT8(p, -1);
WRITESINT8(p, 0);
}
SendNetXCmd(XD_PICKVOTE, &buf, 2);
}

View file

@ -2510,11 +2510,19 @@ static void Y_UnloadVoteData(void)
//
void Y_SetupVoteFinish(SINT8 pick, SINT8 level)
{
if (pick == -1) // No other votes? We gotta get out of here, then!
{
timer = 0;
Y_UnloadVoteData();
Y_FollowIntermission();
return;
}
if (pickedvote == -1)
{
INT32 i;
SINT8 votecompare = -1;
boolean allsame = true;
INT32 endtype = 0;
voteclient.rsynctime = 0;
@ -2523,16 +2531,26 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level)
if ((playeringame[i] && !players[i].spectator) && votes[i] == -1 && !splitscreen)
votes[i] = 3;
if (votes[i] == -1)
if (votes[i] == -1 || endtype > 1) // Don't need to go on
continue;
if (votecompare == -1)
{
votecompare = votes[i];
endtype = 1;
}
else if (votes[i] != votecompare)
allsame = false;
endtype = 2;
}
if (allsame)
if (endtype == 0) // Might as well put this here, too.
{
timer = 0;
Y_UnloadVoteData();
Y_FollowIntermission();
return;
}
else if (endtype == 1) // Only one unique vote, so just end it immediately.
{
voteendtic = votetic + (5*TICRATE);
S_StartSound(NULL, sfx_kc48);