[ioquake3] 05/50: Check for unlimited time power up using INT_MAX

Simon McVittie smcv at debian.org
Sun Jul 23 21:55:22 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository ioquake3.

commit c2ca5e7856bb66715fbacdebf9d70c01fcc9ef11
Author: Zack Middleton <zack at cloemail.com>
Date:   Sat Jun 24 19:53:37 2017 -0500

    Check for unlimited time power up using INT_MAX
    
    It is possible for a power up to exceed 999 seconds without it being
    unlimited time.
---
 code/cgame/cg_draw.c    | 11 ++++++++---
 code/cgame/cg_newdraw.c | 11 ++++++++---
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c
index 4b6df01..9566682 100644
--- a/code/cgame/cg_draw.c
+++ b/code/cgame/cg_draw.c
@@ -1197,10 +1197,15 @@ static float CG_DrawPowerups( float y ) {
 		if ( !ps->powerups[ i ] ) {
 			continue;
 		}
-		t = ps->powerups[ i ] - cg.time;
-		// ZOID--don't draw if the power up has unlimited time (999 seconds)
+
+		// ZOID--don't draw if the power up has unlimited time
 		// This is true of the CTF flags
-		if ( t < 0 || t > 999000) {
+		if ( ps->powerups[ i ] == INT_MAX ) {
+			continue;
+		}
+
+		t = ps->powerups[ i ] - cg.time;
+		if ( t <= 0 ) {
 			continue;
 		}
 
diff --git a/code/cgame/cg_newdraw.c b/code/cgame/cg_newdraw.c
index a2749b2..680bd6c 100644
--- a/code/cgame/cg_newdraw.c
+++ b/code/cgame/cg_newdraw.c
@@ -832,10 +832,15 @@ static void CG_DrawAreaPowerUp(rectDef_t *rect, int align, float special, float
 		if ( !ps->powerups[ i ] ) {
 			continue;
 		}
-		t = ps->powerups[ i ] - cg.time;
-		// ZOID--don't draw if the power up has unlimited time (999 seconds)
+
+		// ZOID--don't draw if the power up has unlimited time
 		// This is true of the CTF flags
-		if ( t <= 0 || t >= 999000) {
+		if ( ps->powerups[ i ] == INT_MAX ) {
+			continue;
+		}
+
+		t = ps->powerups[ i ] - cg.time;
+		if ( t <= 0 ) {
 			continue;
 		}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list