diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_buildable.c | 22 | ||||
-rw-r--r-- | src/game/g_cmds.c | 4 | ||||
-rw-r--r-- | src/game/g_local.h | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 93e11802..3e13ea6f 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -120,7 +120,7 @@ G_FindPower attempt to find power for self, return qtrue if successful ================ */ -qboolean G_FindPower( gentity_t *self ) +qboolean G_FindPower( gentity_t *self, qboolean searchUnspawned ) { int i, j; gentity_t *ent, *ent2; @@ -159,7 +159,7 @@ qboolean G_FindPower( gentity_t *self ) // If entity is a power item calculate the distance to it if( ( ent->s.modelindex == BA_H_REACTOR || ent->s.modelindex == BA_H_REPEATER ) && - ent->spawned && ent->powered && ent->health > 0 ) + ( searchUnspawned || ent->spawned ) && ent->powered && ent->health > 0 ) { VectorSubtract( self->s.origin, ent->s.origin, temp_v ); distance = VectorLength( temp_v ); @@ -297,7 +297,7 @@ gentity_t *G_PowerEntityForPoint( const vec3_t origin ) dummy.s.modelindex = BA_NONE; VectorCopy( origin, dummy.s.origin ); - if( G_FindPower( &dummy ) ) + if( G_FindPower( &dummy, qfalse ) ) return dummy.parentNode; else return NULL; @@ -313,7 +313,7 @@ power for the specified entity */ gentity_t *G_PowerEntityForEntity( gentity_t *ent ) { - if( G_FindPower( ent ) ) + if( G_FindPower( ent, qfalse ) ) return ent->parentNode; return NULL; } @@ -1664,7 +1664,7 @@ void HSpawn_Think( gentity_t *self ) G_SuicideIfNoPower( self ); // set parentNode - self->powered = G_FindPower( self ); + self->powered = G_FindPower( self, qfalse ); if( self->spawned ) { @@ -1937,7 +1937,7 @@ void HArmoury_Think( gentity_t *self ) //make sure we have power self->nextthink = level.time + POWER_REFRESH_TIME; - self->powered = G_FindPower( self ); + self->powered = G_FindPower( self, qfalse ); G_SuicideIfNoPower( self ); } @@ -1963,7 +1963,7 @@ void HDCC_Think( gentity_t *self ) //make sure we have power self->nextthink = level.time + POWER_REFRESH_TIME; - self->powered = G_FindPower( self ); + self->powered = G_FindPower( self, qfalse ); G_SuicideIfNoPower( self ); } @@ -2010,7 +2010,7 @@ void HMedistat_Think( gentity_t *self ) self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink; - self->powered = G_FindPower( self ); + self->powered = G_FindPower( self, qfalse ); G_SuicideIfNoPower( self ); G_IdlePowerState( self ); @@ -2347,7 +2347,7 @@ void HMGTurret_Think( gentity_t *self ) // Turn off client side muzzle flashes self->s.eFlags &= ~EF_FIRING; - self->powered = G_FindPower( self ); + self->powered = G_FindPower( self, qfalse ); G_SuicideIfNoPower( self ); G_IdlePowerState( self ); @@ -2428,7 +2428,7 @@ void HTeslaGen_Think( gentity_t *self ) { self->nextthink = level.time + BG_Buildable( self->s.modelindex )->nextthink; - self->powered = G_FindPower( self ); + self->powered = G_FindPower( self, qfalse ); G_SuicideIfNoPower( self ); G_IdlePowerState( self ); @@ -3626,7 +3626,7 @@ static gentity_t *G_Build( gentity_t *builder, buildable_t buildable, vec3_t ori built->powered = qtrue; built->s.eFlags |= EF_B_POWERED; } - else if( ( built->powered = G_FindPower( built ) ) ) + else if( ( built->powered = G_FindPower( built, qfalse ) ) ) built->s.eFlags |= EF_B_POWERED; built->s.eFlags &= ~EF_B_SPAWNED; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index caa73ccd..65f34ef6 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1670,7 +1670,7 @@ void Cmd_Destroy_f( gentity_t *ent ) if( !g_markDeconstruct.integer || ( ent->client->pers.teamSelection == TEAM_HUMANS && - !G_FindPower( traceEnt ) ) ) + !G_FindPower( traceEnt, qtrue ) ) ) { if( ent->client->ps.stats[ STAT_MISC ] > 0 ) { @@ -1688,7 +1688,7 @@ void Cmd_Destroy_f( gentity_t *ent ) } else if( g_markDeconstruct.integer && ( ent->client->pers.teamSelection != TEAM_HUMANS || - G_FindPower( traceEnt ) || lastSpawn ) ) + G_FindPower( traceEnt , qtrue ) || lastSpawn ) ) { traceEnt->deconstruct = qtrue; // Mark buildable for deconstruction traceEnt->deconstructTime = level.time; diff --git a/src/game/g_local.h b/src/game/g_local.h index 147a43c4..51cf3ac0 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -755,7 +755,7 @@ void G_BaseSelfDestruct( team_t team ); int G_NextQueueTime( int queuedBP, int totalBP, int queueBaseRate ); void G_QueueBuildPoints( gentity_t *self ); int G_GetBuildPoints( const vec3_t pos, team_t team, int dist ); -qboolean G_FindPower( gentity_t *self ); +qboolean G_FindPower( gentity_t *self, qboolean searchUnspawned ); gentity_t *G_PowerEntityForPoint( const vec3_t origin ); gentity_t *G_PowerEntityForEntity( gentity_t *ent ); gentity_t *G_RepeaterEntityForPoint( vec3_t origin ); |