1
0
forked from 0ad/0ad

# Fixed a bug with entities disappearing when they die.

This was SVN commit r4873.
This commit is contained in:
Matei 2007-02-08 05:38:53 +00:00
parent 102b3925ac
commit a11c12f848

View File

@ -256,6 +256,9 @@ void CEntity::kill(bool keepActor)
g_Selection.removeAll( me ); g_Selection.removeAll( me );
entf_set(ENTF_DESTROYED);
g_EntityManager.SetDeath(true); // remember that a unit died this frame
// If we have a death animation and want to keep the actor, play that animation // If we have a death animation and want to keep the actor, play that animation
if( keepActor && m_actor && if( keepActor && m_actor &&
m_actor->GetRandomAnimation( "death" ) != m_actor->GetRandomAnimation( "idle" ) ) m_actor->GetRandomAnimation( "death" ) != m_actor->GetRandomAnimation( "idle" ) )
@ -265,7 +268,9 @@ void CEntity::kill(bool keepActor)
m_position_previous = m_position; m_position_previous = m_position;
m_graphics_orientation = m_orientation; m_graphics_orientation = m_orientation;
m_orientation_previous = m_orientation; m_orientation_previous = m_orientation;
snapToGround();
updateActorTransforms(); updateActorTransforms();
m_actor_transform_valid = true;
// Play death animation and keep the actor in the game in a dead state // Play death animation and keep the actor in the game in a dead state
// (TODO: remove the actor after some time through some kind of fading mechanism) // (TODO: remove the actor after some time through some kind of fading mechanism)
@ -277,16 +282,11 @@ void CEntity::kill(bool keepActor)
g_Game->GetWorld()->GetUnitManager().RemoveUnit( m_actor ); g_Game->GetWorld()->GetUnitManager().RemoveUnit( m_actor );
delete( m_actor ); delete( m_actor );
m_actor = NULL; m_actor = NULL;
}
entf_set(ENTF_DESTROYED);
g_EntityManager.m_refd[me.m_handle] = false; g_EntityManager.m_refd[me.m_handle] = false;
g_EntityManager.SetDeath(true); // remember that a unit died this frame
me = HEntity(); // Will deallocate the entity, assuming nobody else has a reference to it me = HEntity(); // Will deallocate the entity, assuming nobody else has a reference to it
} }
}
void CEntity::SetPlayer(CPlayer *pPlayer) void CEntity::SetPlayer(CPlayer *pPlayer)
{ {