From c2ca5e7856bb66715fbacdebf9d70c01fcc9ef11 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 24 Jun 2017 19:53:37 -0500 Subject: [PATCH] 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 4b6df017..95666822 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 a2749b2a..680bd6c1 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; }