From 43ea36ac9bea52cd058c81a8697878c508a0eb4b Mon Sep 17 00:00:00 2001 From: Petr Pudlak Date: Sat, 20 Sep 2014 16:14:54 +0200 Subject: Show negative build points even after sudden death While it's not possible to build after SD, it's possible that buildings die due to too little BPs. --- src/game/g_buildable.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 856db29..90df479 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -387,22 +387,23 @@ gentity_t *G_IsGathered( team_t team, vec3_t origin, qboolean omRcOnly, gentity_ ================== G_GetBuildPoints -Get the number of build points from a position +Get the number of build points from a position. + +If sudden death has started, the returned value might be negative, +but is never positive. ================== */ int G_GetBuildPoints( const vec3_t pos, team_t team ) { - if( G_TimeTilSuddenDeath( ) <= 0 ) - { - return 0; - } - else if( !G_Overmind( ) && team == TEAM_ALIENS ) + int value = 0; + + if( !G_Overmind( ) && team == TEAM_ALIENS ) { return 0; } else if( team == TEAM_ALIENS ) { - return level.alienBuildPoints; + value = level.alienBuildPoints; } else if( !G_Reactor( ) && team == TEAM_HUMANS ) { @@ -410,10 +411,15 @@ int G_GetBuildPoints( const vec3_t pos, team_t team ) } else if( team == TEAM_HUMANS ) { - return level.humanBuildPoints; + value = level.humanBuildPoints; } + else + return 0; - return 0; + if( ( value > 0 ) && ( G_TimeTilSuddenDeath( ) <= 0 ) ) + return 0; + else + return value; } /* -- cgit