summaryrefslogtreecommitdiff
path: root/src/game/g_buildable.c
diff options
context:
space:
mode:
authorJohn Ellis <johne@verizon.net>2010-12-12 22:18:47 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:49 +0000
commit1f460b904ddc2aa6f5aa793668d1c005aa53898e (patch)
treed9b9d409ce60095099239db1248959d1303c56c6 /src/game/g_buildable.c
parent2cf02437142b47e07095472992e9bfd4e17ae0c8 (diff)
* Fix revert when rewinding through replacement and removal of the same buildable.
Diffstat (limited to 'src/game/g_buildable.c')
-rw-r--r--src/game/g_buildable.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index da21798d..786dd19f 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -4244,19 +4244,22 @@ void G_BuildLogRevert( int id )
for( i = MAX_CLIENTS; i < level.num_entities; i++ )
{
ent = &g_entities[ i ];
- if( ent->s.eType != ET_BUILDABLE ||
- ent->s.modelindex != log->modelindex ||
- ent->health <= 0 )
- continue;
-
- VectorSubtract( ent->s.pos.trBase, log->origin, dist );
- if( VectorLengthSquared( dist ) > 2.0f )
- continue;
-
- G_LogPrintf( "revert: remove %d %s\n",
- ent - g_entities, BG_Buildable( ent->s.modelindex )->name );
- G_FreeEntity( ent );
- break;
+ if( ( ( ent->s.eType == ET_BUILDABLE &&
+ ent->health > 0 ) ||
+ ( ent->s.eType == ET_GENERAL &&
+ ent->think == G_BuildLogRevertThink ) ) &&
+ ent->s.modelindex == log->modelindex )
+ {
+ VectorSubtract( ent->s.pos.trBase, log->origin, dist );
+ if( VectorLengthSquared( dist ) <= 2.0f )
+ {
+ if( ent->s.eType == ET_BUILDABLE )
+ G_LogPrintf( "revert: remove %d %s\n",
+ ent - g_entities, BG_Buildable( ent->s.modelindex )->name );
+ G_FreeEntity( ent );
+ break;
+ }
+ }
}
}
else