summaryrefslogtreecommitdiff
path: root/src/game/g_buildable.c
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2012-07-12 02:46:19 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:18:16 +0000
commit8d448680f5b3bcd2a67a3684308bb948e4d3ddad (patch)
tree8ec357b00c06d7b2e851680270690ad8e5ee3504 /src/game/g_buildable.c
parent156289dcdd27a31e77afb36147d456bac9be72a3 (diff)
* (bug 5000) refactor: use ARRAY_LEN; remove undefined functions; more size_t
(/dev/humancontroller)
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r--src/game/g_buildable.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 0f7ec7e6..f1bb1c12 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -172,17 +172,13 @@ qboolean G_FindPower( gentity_t *self, qboolean searchUnspawned )
// Scan the buildables in the reactor zone
for( j = MAX_CLIENTS, ent2 = g_entities + j; j < level.num_entities; j++, ent2++ )
{
- gentity_t *powerEntity;
-
if( ent2->s.eType != ET_BUILDABLE )
continue;
if( ent2 == self )
continue;
- powerEntity = ent2->parentNode;
-
- if( powerEntity && powerEntity->s.modelindex == BA_H_REACTOR && ( powerEntity == ent ) )
+ if( ent2->parentNode == ent )
{
buildPoints -= BG_Buildable( ent2->s.modelindex )->buildPoints;
}
@@ -224,20 +220,14 @@ qboolean G_FindPower( gentity_t *self, qboolean searchUnspawned )
// Scan the buildables in the repeater zone
for( j = MAX_CLIENTS, ent2 = g_entities + j; j < level.num_entities; j++, ent2++ )
{
- gentity_t *powerEntity;
-
if( ent2->s.eType != ET_BUILDABLE )
continue;
if( ent2 == self )
continue;
- powerEntity = ent2->parentNode;
-
- if( powerEntity && powerEntity->s.modelindex == BA_H_REPEATER && ( powerEntity == ent ) )
- {
+ if( ent2->parentNode == ent )
buildPoints -= BG_Buildable( ent2->s.modelindex )->buildPoints;
- }
}
if( ent->usesBuildPointZone && level.buildPointZones[ ent->buildPointZone ].active )
@@ -2956,7 +2946,7 @@ static int G_CompareBuildablesForRemoval( const void *a, const void *b )
}
// Resort to preference list
- for( i = 0; i < sizeof( precedence ) / sizeof( precedence[ 0 ] ); i++ )
+ for( i = 0; i < ARRAY_LEN( precedence ); i++ )
{
if( buildableA->s.modelindex == precedence[ i ] )
aPrecedence = i;