diff options
author | Roman Tetelman <kevlarman@gmail.com> | 2009-10-03 12:25:42 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:57 +0000 |
commit | 5d44bbcf8a2b2ff4c5c43e3ba3f5c7196a7d01cf (patch) | |
tree | 7ab763930698e7839cf0a1f8f9be652aa689af83 /src | |
parent | 12e5010c825c09e377bc6bffd9ae68a35a0f8405 (diff) |
* Fix for building spawns over marked buildables (fixes #14)
* Ignore marked buildables that the spawn will replace when checking
for anything that will block it.
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_buildable.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 8a80adf0..7ae279d7 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2799,6 +2799,8 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, buildable_t core; int spawnCount = 0; + level.numBuildablesForRemoval = 0; + if( team == TEAM_ALIENS ) { remainingBP = level.alienBuildPoints; @@ -2843,8 +2845,6 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable, // Set buildPoints to the number extra that are required buildPoints -= remainingBP; - level.numBuildablesForRemoval = 0; - // Build a list of buildable entities for( i = MAX_CLIENTS, ent = g_entities + i; i < level.num_entities; i++, ent++ ) { @@ -2995,6 +2995,21 @@ static void G_SetBuildableLinkState( qboolean link ) } } +static void G_SetBuildableMarkedLinkState( qboolean link ) +{ + int i; + gentity_t *ent; + + for( i = 0; i < level.numBuildablesForRemoval; i++ ) + { + ent = level.markedBuildables[ i ]; + if( link ) + trap_LinkEntity( ent ); + else + trap_UnlinkEntity( ent ); + } +} + /* ================ G_CanBuild @@ -3144,8 +3159,13 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance G_SetBuildableLinkState( qtrue ); //check there is enough room to spawn from (presuming this is a spawn) - if( G_CheckSpawnPoint( ENTITYNUM_NONE, origin, normal, buildable, NULL ) != NULL ) - reason = IBE_NORMAL; + if( reason == IBE_NONE ) + { + G_SetBuildableMarkedLinkState( qfalse ); + if( G_CheckSpawnPoint( ENTITYNUM_NONE, origin, normal, buildable, NULL ) != NULL ) + reason = IBE_NORMAL; + G_SetBuildableMarkedLinkState( qtrue ); + } //this item does not fit here if( reason == IBE_NONE && ( tr2.fraction < 1.0 || tr3.fraction < 1.0 ) ) |