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.

refactor(gameengine): close the last client reads of the 4v4 census

Olcay Seygan620a17fe6f04
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h
index 1cc7c3acf..6663fa8c6 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/LaserUpdate.h
@@ -92,7 +92,7 @@ public:
protected:
- void updateStartPos(); ///< figures out and sets startPos
+ void updateStartPos( const Drawable *parentDrawable = NULL ); ///< figures out and sets startPos; NULL looks the parent up by m_parentID
void updateEndPos(); ///< figures out and sets endPos
Real computeWidthScalar( UnsignedInt frame ) const; ///< the width on that logic frame, from the frames alone
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
index 918bd61a9..05be44e60 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp
@@ -1426,8 +1426,12 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay )
{
++considered;
- // if this isn't one of the objects that can be preloaded ignore it
- if( tTemplate->isKindOf( KINDOF_PRELOAD ) == FALSE && !TheGlobalData->m_preloadEverything )
+ // if this isn't one of the objects that can be preloaded ignore it. A parachute and what hangs
+ // under it (a Supply Drop Zone crate) are made in the tick and asked for their bones in the same
+ // tick (ParachuteContain), before their flush; made here first, their module data has the bones
+ // already and the tick loads no model (LOGIC-THREAD.md M8)
+ if( tTemplate->isKindOf( KINDOF_PRELOAD ) == FALSE && tTemplate->isKindOf( KINDOF_PARACHUTE ) == FALSE
+ && tTemplate->isKindOf( KINDOF_PARACHUTABLE ) == FALSE && !TheGlobalData->m_preloadEverything )
continue;
// create the drawable and do the preloading
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp
index 6bb97af1f..aee2b0884 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/LaserUpdate.cpp
@@ -110,14 +110,15 @@ LaserUpdate::~LaserUpdate( void )
}
//-------------------------------------------------------------------------------------------------
-void LaserUpdate::updateStartPos()
+void LaserUpdate::updateStartPos( const Drawable *parentDrawable )
{
Coord3D oldStartPos = m_startPos;
if( m_parentID == INVALID_DRAWABLE_ID )
return;// Can't update if not told to update
- const Drawable *parentDrawable = TheGameClient->findDrawableByID(m_parentID);
+ if( parentDrawable == NULL )
+ parentDrawable = TheGameClient->findDrawableByID(m_parentID);
if( parentDrawable == NULL )
return;// Can't update if no one to ask
@@ -284,7 +285,9 @@ void LaserUpdate::initLaser( const Object *parent, const Object *target, const C
if( parent->getDrawable() )
m_parentID = parent->getDrawable()->getID();
- updateStartPos();
+ // the parent's drawable as the object holds it: initLaser runs in the tick, which does not look
+ // drawables up in the client's table (LOGIC-THREAD.md M8)
+ updateStartPos( parent->getDrawable() );
}
else if( startPos )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp
index b031397a9..25c4c987e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp
@@ -3301,7 +3301,10 @@ void ScriptActions::doDisableInput()
if (!TheGlobalData->m_disableScriptedInputDisabling)
#endif
{
- // all of it is the client's: after the tick (LOGIC-THREAD.md M6)
+ // all of it is the client's: after the tick (LOGIC-THREAD.md M6); the selection the tick reads
+ // back empties now, as the immediate call emptied it (M7's block)
+ if( LogicThread::defersEffects() )
+ LogicThread::noteSelectionCleared();
LogicThread::callAfterTick( []{
TheInGameUI->setInputEnabled(false);
TheMouse->setVisibility(false);