diff options
author | Tony J. White <tjw@tjw.org> | 2006-09-14 16:18:33 +0000 |
---|---|---|
committer | Tony J. White <tjw@tjw.org> | 2006-09-14 16:18:33 +0000 |
commit | cedeac9325fd4b0a0de0a5fba1890d8368754a01 (patch) | |
tree | 28f39728bf42f267b0425623fbe4918dd5c32472 /src | |
parent | e619da81c77cea380e664942b75341fe094ed33d (diff) |
* (bug 2952) repeaters could be built in some powered zones (Martin Doucha)
Diffstat (limited to 'src')
-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 |