From 5fb49acda87d4b4b1e6015626092d2afd5565378 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Fri, 20 Mar 2015 21:09:04 -0500 Subject: [PATCH] Clean up CG_DrawProxWarning design Hopefully fixes the following warning cg_draw.c:2315 assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Wstrict-overflow] --- code/cgame/cg_draw.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index e9c7d4da..ab8fb59b 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -2298,8 +2298,7 @@ static void CG_DrawProxWarning( void ) { char s [32]; int w; static int proxTime; - static int proxCounter; - static int proxTick; + int proxTick; if( !(cg.snap->ps.eFlags & EF_TICKING ) ) { proxTime = 0; @@ -2307,17 +2306,12 @@ static void CG_DrawProxWarning( void ) { } if (proxTime == 0) { - proxTime = cg.time + 5000; - proxCounter = 5; - proxTick = 0; + proxTime = cg.time; } - if (cg.time > proxTime) { - proxTick = proxCounter--; - proxTime = cg.time + 1000; - } + proxTick = 10 - ((cg.time - proxTime) / 1000); - if (proxTick != 0) { + if (proxTick > 0 && proxTick <= 5) { Com_sprintf(s, sizeof(s), "INTERNAL COMBUSTION IN: %i", proxTick); } else { Com_sprintf(s, sizeof(s), "YOU HAVE BEEN MINED");