From 47ecc6370bfe8ca888281e3573c59e588df5f26b Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 11 Apr 2023 12:40:34 +0100 Subject: [PATCH] K_UsingPowerLevels: Clean up significantly - Comment each restriction/enablement - Fix the roundqueue PWR disabling to only occour when the roundqueue is in action, as opposed to when it has any entries at all --- src/k_pwrlv.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/k_pwrlv.c b/src/k_pwrlv.c index ffab53778..a93445184 100644 --- a/src/k_pwrlv.c +++ b/src/k_pwrlv.c @@ -37,23 +37,38 @@ consvar_t cv_debugencorevote = CVAR_INIT ("debugencorevote", "Off", CV_CHEAT|CV_ SINT8 K_UsingPowerLevels(void) { - SINT8 pt = PWRLV_DISABLED; - - if (!cv_kartusepwrlv.value || !(netgame || (demo.playback && demo.netgame)) || grandprixinfo.gp == true || roundqueue.size > 0) + if (!cv_kartusepwrlv.value) { + // Explicitly forbidden. + return PWRLV_DISABLED; + } + + if (!(netgame || (demo.playback && demo.netgame))) + { + // Servers only. + return PWRLV_DISABLED; + } + + if (roundqueue.size > 0 && roundqueue.position > 0) + { + // When explicit progression is in place, we're going by different rules. return PWRLV_DISABLED; } if (gametype == GT_RACE) { - pt = PWRLV_RACE; - } - else if (gametype == GT_BATTLE) - { - pt = PWRLV_BATTLE; + // Race PWR. + return PWRLV_RACE; } - return pt; + if (gametype == GT_BATTLE) + { + // Battle PWR. + return PWRLV_BATTLE; + } + + // We do not support PWR for custom gametypes at this moment in time. + return PWRLV_DISABLED; } void K_ClearClientPowerLevels(void)