Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameclient): run a dying drawable's deferred work before deleting it

Olcay Seygand3aaa524115f
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
index 3a2054416..cdcec8334 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h
@@ -453,6 +453,7 @@ public:
client's list and lookup after the tick too (GameClient::linkDrawablesOfTick). */
static Bool tickDefersLifetime();
void flushPendingTransform( Bool onDemand ); ///< tells the draw modules of a transform the tick deferred; GameClient::destroyDrawable
+ void doPendingClientWork( Bool onDemand ); ///< everything the tick deferred on this drawable; flushDestroyedDrawables for one the tick also destroyed
/** Where a doClientWork goes among the model condition states the tick has not applied yet. */
enum ClientWorkOrder
{
@@ -876,7 +877,6 @@ private:
void recordConditionStep() const;
void deferModelConditionFlush() const;
void flushModelCondition( Bool onDemand ) const;
- void doPendingClientWork( Bool onDemand );
void markModelDirty();
//*******************************************
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
index ab6c1f464..19d514e9a 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
@@ -1114,8 +1114,9 @@ void GameClient::flushDestroyedDrawables( void )
for( size_t i = 0; i < m_destroyedInTick.size(); ++i )
{
LOGIC_CENSUS( CENSUS_DESTROY_DRAWABLE );
- // the move the tick deferred, as the immediate path above: a model's last place before it goes
- m_destroyedInTick[ i ]->flushPendingTransform( FALSE );
+ // what the tick deferred on it before it died, which flushPendingClientWork no longer finds by ID:
+ // the last mine's detonation FX, and the model's last place as on the immediate path above
+ m_destroyedInTick[ i ]->doPendingClientWork( FALSE );
m_destroyedInTick[ i ]->deleteInstance();
}
m_destroyedInTick.clear();