summaryrefslogtreecommitdiff
path: root/src/game/g_buildable.c
diff options
context:
space:
mode:
authorPetr Pudlak <petr.mvd@gmail.com>2014-09-20 16:14:54 +0200
committerPetr Pudlak <petr.mvd@gmail.com>2014-09-20 16:14:54 +0200
commit43ea36ac9bea52cd058c81a8697878c508a0eb4b (patch)
tree7e852527e88e9cd008674fcaae6acd1b0d3bef03 /src/game/g_buildable.c
parentd15d03572381c449024f385f4774f1c4bc95e227 (diff)
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.
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r--src/game/g_buildable.c24
1 files changed, 15 insertions, 9 deletions
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;
}
/*