Two fixes to playersforexit changes.

* Crash prevention if total somehow becomes zero.
* Don't waste time multiplying and demultiplying the HUD check if it's just gonna net you the same number.
This commit is contained in:
toasterbabe 2017-07-08 11:41:20 +01:00
parent b197dcdb1f
commit 317259a459
2 changed files with 7 additions and 4 deletions

View File

@ -9435,7 +9435,7 @@ void P_PlayerThink(player_t *player)
exiting++; exiting++;
} }
if (((4*exiting)/total) >= cv_playersforexit.value) if (!total || ((4*exiting)/total) >= cv_playersforexit.value)
{ {
if (server) if (server)
SendNetXCmd(XD_EXITLEVEL, NULL, 0); SendNetXCmd(XD_EXITLEVEL, NULL, 0);

View File

@ -2013,9 +2013,12 @@ static void ST_overlayDrawer(void)
exiting++; exiting++;
} }
total *= cv_playersforexit.value; if (cv_playersforexit.value != 4)
if (total % 4) total += 4; // round up {
total /= 4; total *= cv_playersforexit.value;
if (total % 4) total += 4; // round up
total /= 4;
}
if (exiting >= total) if (exiting >= total)
; ;