From ce74a4c964b8060f83cf6641ca17159ac6df53f3 Mon Sep 17 00:00:00 2001 From: TehRealSalt <tehrealsalt@gmail.com> Date: Thu, 1 Mar 2018 17:05:36 -0500 Subject: [PATCH] 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 --- src/d_netcmd.c | 12 ++++++++++-- src/y_inter.c | 26 ++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 09fa39ff..3099ca45 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -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); } diff --git a/src/y_inter.c b/src/y_inter.c index 8fdbac27..ed651ce3 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -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);