summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 12:55:39 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:20 +0000
commit5d0545b0427813e9841d876d6022b5e4f664effd (patch)
tree7aa886b5def2b92826e4333449b1a8494232e7e6 /src/game
parentffe206839d23ace504995e23128e97af8dc3afcf (diff)
show the BP of the main / reactor zone by default
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_buildable.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index f8b4eb99..e11fb109 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -421,6 +421,9 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance )
return level.powerZones[ powerPoint->zone ].totalBuildPoints -
level.powerZones[ powerPoint->zone ].queuedBuildPoints;
}
+
+ // Return the BP of the main zone by default
+ return level.humanBuildPoints;
}
return 0;
@@ -432,6 +435,7 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance )
int distance = 0;
vec3_t temp_v;
int buildPoints = 0;
+ qboolean zoneFound = qfalse;
if( level.suddenDeath )
{
@@ -450,6 +454,8 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance )
if( ent->s.modelindex == BA_H_REACTOR && distance <= REACTOR_BASESIZE + extraDistance )
{
// Reactor is in range
+ zoneFound = qtrue;
+
buildPoints += level.humanBuildPoints;
}
else if( ent->s.modelindex == BA_H_REPEATER && distance <= REPEATER_BASESIZE + extraDistance )
@@ -458,6 +464,8 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance )
{
zone_t *zone = &level.powerZones[ent->zone];
+ zoneFound = qtrue;
+
buildPoints += zone->totalBuildPoints - zone->queuedBuildPoints;
}
}
@@ -471,6 +479,9 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance )
if( buildPoints < 0 )
buildPoints = 0;
+ if( !zoneFound )
+ buildPoints = level.humanBuildPoints; // if the player isn't in a zone, show the number of BP of the main zone
+
return buildPoints;
#endif
}