diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 12:54:05 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:18 +0000 |
commit | a9aefb6d2bbfcd40602837685f6b6b257620aeec (patch) | |
tree | fb041fafe1d9737055f90ff29f4d2d9d7fd386be /src/game/g_buildable.c | |
parent | b651c4159020dd29d2a5c801579a5224a1af0264 (diff) |
Fixes to alien BP counting and markdecon
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r-- | src/game/g_buildable.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 99c6ca94..152ed564 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -356,12 +356,24 @@ Get the number of build points from a position */ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance ) { - gentity_t *powerPoint = G_PowerEntityForPoint( pos ); + if( team == TEAM_ALIENS ) + { + return level.alienBuildPoints; + } + else if( team == TEAM_HUMANS ) + { + gentity_t *powerPoint = G_PowerEntityForPoint( pos ); - if( powerPoint && powerPoint->s.modelindex == BA_H_REACTOR ) - return level.humanBuildPoints; - if( powerPoint && powerPoint->s.modelindex == BA_H_REPEATER && powerPoint->usesZone && level.powerZones[ powerPoint->zone ].active ) - return level.powerZones[ powerPoint->zone ].totalBuildPoints - level.powerZones[ powerPoint->zone ].queuedBuildPoints; + if( powerPoint && powerPoint->s.modelindex == BA_H_REACTOR ) + return level.humanBuildPoints; + + if( powerPoint && powerPoint->s.modelindex == BA_H_REPEATER && + powerPoint->usesZone && level.powerZones[ powerPoint->zone ].active ) + { + return level.powerZones[ powerPoint->zone ].totalBuildPoints - + level.powerZones[ powerPoint->zone ].queuedBuildPoints; + } + } return 0; @@ -3155,9 +3167,11 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, // Don't allow marked buildables to be replaced in another zone, // unless the marked buildable isn't in a zone (and thus unpowered) - if( buildable != BA_H_REACTOR && buildable != BA_H_REPEATER && - G_PowerEntityForPoint( ent->s.origin ) != G_PowerEntityForPoint( origin ) && - G_PowerEntityForPoint( ent->s.origin ) ) + if( team == TEAM_HUMANS && + buildable != BA_H_REACTOR && + buildable != BA_H_REPEATER && + G_PowerEntityForPoint( ent->s.origin ) && + G_PowerEntityForPoint( ent->s.origin ) != G_PowerEntityForPoint( origin ) ) continue; if( !ent->inuse ) @@ -3179,7 +3193,9 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, continue; // Don't allow a power source to be replaced by a non-power source - if( buildable != BA_H_REACTOR && buildable != BA_H_REPEATER && + if( team == TEAM_HUMANS && + buildable != BA_H_REACTOR && + buildable != BA_H_REPEATER && !( ent->s.modelindex == BA_H_REACTOR || ent->s.modelindex == BA_H_REPEATER ) ) continue; |