summaryrefslogtreecommitdiff
path: root/src/game/g_buildable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r--src/game/g_buildable.c52
1 files changed, 49 insertions, 3 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index dd603309..2be2bf45 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -335,7 +335,7 @@ G_GetBuildPoints
Get the number of build points from a position
==================
*/
-int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance )
+int G_GetBuildPoints( const vec3_t pos, team_t team )
{
if( G_TimeTilSuddenDeath( ) <= 0 )
{
@@ -368,6 +368,52 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance )
/*
==================
+G_GetMarkedBuildPoints
+
+Get the number of marked build points from a position
+==================
+*/
+int G_GetMarkedBuildPoints( const vec3_t pos, team_t team )
+{
+ gentity_t *ent;
+ int i;
+ int sum = 0;
+
+ if( G_TimeTilSuddenDeath( ) <= 0 )
+ return 0;
+
+ if( !g_markDeconstruct.integer )
+ return 0;
+
+ for( i = MAX_CLIENTS, ent = g_entities + i; i < level.num_entities; i++, ent++ )
+ {
+ if( ent->s.eType != ET_BUILDABLE )
+ continue;
+
+ if( team == TEAM_HUMANS &&
+ ent->s.modelindex != BA_H_REACTOR &&
+ ent->s.modelindex != BA_H_REPEATER &&
+ ent->parentNode != G_PowerEntityForPoint( pos ) )
+ continue;
+
+ if( !ent->inuse )
+ continue;
+
+ if( ent->health <= 0 )
+ continue;
+
+ if( ent->buildableTeam != team )
+ continue;
+
+ if( ent->deconstruct )
+ sum += BG_Buildable( ent->s.modelindex )->buildPoints;
+ }
+
+ return sum;
+}
+
+/*
+==================
G_InPowerZone
See if a buildable is inside of another power zone.
@@ -3053,7 +3099,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable,
if( team == TEAM_ALIENS )
{
- remainingBP = G_GetBuildPoints( origin, team, 0 );
+ remainingBP = G_GetBuildPoints( origin, team );
remainingSpawns = level.numAlienSpawns;
bpError = IBE_NOALIENBP;
spawn = BA_A_SPAWN;
@@ -3064,7 +3110,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable,
if( buildable == BA_H_REACTOR || buildable == BA_H_REPEATER )
remainingBP = level.humanBuildPoints;
else
- remainingBP = G_GetBuildPoints( origin, team, 0 );
+ remainingBP = G_GetBuildPoints( origin, team );
remainingSpawns = level.numHumanSpawns;
bpError = IBE_NOHUMANBP;