diff options
-rw-r--r-- | src/game/g_buildable.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 59040d0e..b9859258 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -166,7 +166,6 @@ static qboolean findPower( gentity_t *self ) int distance = 0; int minDistance = 10000; vec3_t temp_v; - qboolean foundPower = qfalse; if( self->biteam != BIT_HUMANS ) return qfalse; @@ -194,26 +193,22 @@ static qboolean findPower( gentity_t *self ) { VectorSubtract( self->s.origin, ent->s.origin, temp_v ); distance = VectorLength( temp_v ); - if( distance < minDistance && ent->powered ) - { - closestPower = ent; - minDistance = distance; - foundPower = qtrue; + + if( distance < minDistance && ent->powered && + ( ( ent->s.modelindex == BA_H_REACTOR && + distance <= REACTOR_BASESIZE ) || + ( ent->s.modelindex == BA_H_REPEATER && + distance <= REPEATER_BASESIZE ) ) ) { + + closestPower = ent; + minDistance = distance; } } } //if there were no power items nearby give up - if( !foundPower ) - return qfalse; - - //bleh - if( ( closestPower->s.modelindex == BA_H_REACTOR && ( minDistance <= REACTOR_BASESIZE ) ) || - ( closestPower->s.modelindex == BA_H_REPEATER && ( minDistance <= REPEATER_BASESIZE ) && - closestPower->powered ) ) - { + if( closestPower ) { self->parentNode = closestPower; - return qtrue; } else |