From a5dda9cc47bd50f1775e86ac4aff2657f2378fd8 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Thu, 13 Aug 2026 01:27:58 -0400 Subject: [PATCH 1/3] bugfix(saveload): Save the next evaluation frame of delayed scripts --- .../Code/GameEngine/Include/GameLogic/Scripts.h | 2 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h index 9343b6ff0cc..859e416369e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h @@ -624,9 +624,9 @@ class Script : public MemoryPoolObject, public Snapshot ScriptAction *m_action; ///< First in a list of actions executed if the conditions are true. ScriptAction *m_actionFalse;///< First in a list of actions executed if the conditions are false. Script *m_nextScript; ///< Next in the list of scripts. + UnsignedInt m_frameToEvaluateAt; ///< When to evaluate the conditions next, if m_delayEvaluationSeconds>0. // Runtime fields - not saved or read. - UnsignedInt m_frameToEvaluateAt; ///< When to evaluate the conditions next, if m_delayEvaluationSeconds>0. Bool m_hasWarnings; ///< Runtime flag used by the editor only. AsciiString m_conditionTeamName; ///< Runtime name used by ScriptEngine only. Real m_conditionTime; ///< Amount of time (cum) to evaluate conditions. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index c9dd8a5efbe..d642ebb07a1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -949,13 +949,14 @@ void Script::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Added m_frameToEvaluateAt */ // ------------------------------------------------------------------------------------------------ void Script::xfer( Xfer *xfer ) { // version - XferVersion currentVersion = 1; + XferVersion currentVersion = 2; XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -964,6 +965,12 @@ void Script::xfer( Xfer *xfer ) xfer->xferBool( &active ); setActive( active ); + // TheSuperHackers @bugfix bobtista 13/08/2026 Save the next evaluation frame of delayed scripts + if( version >= 2 ) + { + xfer->xferUnsignedInt( &m_frameToEvaluateAt ); + } + } // ------------------------------------------------------------------------------------------------ From 6487293870d5d0af3a07a62ee50fee1655f26322 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Thu, 13 Aug 2026 18:11:13 -0400 Subject: [PATCH 2/3] bugfix(saveload): Save the next evaluation frame of delayed scripts (Generals) --- Generals/Code/GameEngine/Include/GameLogic/Scripts.h | 2 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/Scripts.h b/Generals/Code/GameEngine/Include/GameLogic/Scripts.h index c2a85ecfd0f..a69bf56c69a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Scripts.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Scripts.h @@ -616,9 +616,9 @@ class Script : public MemoryPoolObject, public Snapshot ScriptAction *m_action; ///< First in a list of actions executed if the conditions are true. ScriptAction *m_actionFalse;///< First in a list of actions executed if the conditions are false. Script *m_nextScript; ///< Next in the list of scripts. + UnsignedInt m_frameToEvaluateAt; ///< When to evaluate the conditions next, if m_delayEvaluationSeconds>0. // Runtime fields - not saved or read. - UnsignedInt m_frameToEvaluateAt; ///< When to evaluate the conditions next, if m_delayEvaluationSeconds>0. Bool m_hasWarnings; ///< Runtime flag used by the editor only. AsciiString m_conditionTeamName; ///< Runtime name used by ScriptEngine only. Real m_conditionTime; ///< Amount of time (cum) to evaluate conditions. diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 74263ba13ef..1da0c89aba8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -941,13 +941,14 @@ void Script::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Added m_frameToEvaluateAt */ // ------------------------------------------------------------------------------------------------ void Script::xfer( Xfer *xfer ) { // version - XferVersion currentVersion = 1; + XferVersion currentVersion = 2; XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -956,6 +957,12 @@ void Script::xfer( Xfer *xfer ) xfer->xferBool( &active ); setActive( active ); + // TheSuperHackers @bugfix bobtista 13/08/2026 Save the next evaluation frame of delayed scripts + if( version >= 2 ) + { + xfer->xferUnsignedInt( &m_frameToEvaluateAt ); + } + } // ------------------------------------------------------------------------------------------------ From 3fa665b360860202923e9db5898fa3682d8a78a2 Mon Sep 17 00:00:00 2001 From: Bobby Battista Date: Thu, 13 Aug 2026 20:01:33 -0400 Subject: [PATCH 3/3] refactor(saveload): Gate the delayed script xfer version behind RETAIL_COMPATIBLE_XFER_SAVE --- .../GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp | 8 ++++++-- .../GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 1da0c89aba8..cc6b5542fdb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -942,13 +942,18 @@ void Script::crc( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: Added m_frameToEvaluateAt */ + * 2: TheSuperHackers @bugfix bobtista 13/08/2026 Save the next evaluation frame of delayed scripts + */ // ------------------------------------------------------------------------------------------------ void Script::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -957,7 +962,6 @@ void Script::xfer( Xfer *xfer ) xfer->xferBool( &active ); setActive( active ); - // TheSuperHackers @bugfix bobtista 13/08/2026 Save the next evaluation frame of delayed scripts if( version >= 2 ) { xfer->xferUnsignedInt( &m_frameToEvaluateAt ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index d642ebb07a1..1273c6671dc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -950,13 +950,18 @@ void Script::crc( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: Added m_frameToEvaluateAt */ + * 2: TheSuperHackers @bugfix bobtista 13/08/2026 Save the next evaluation frame of delayed scripts + */ // ------------------------------------------------------------------------------------------------ void Script::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -965,7 +970,6 @@ void Script::xfer( Xfer *xfer ) xfer->xferBool( &active ); setActive( active ); - // TheSuperHackers @bugfix bobtista 13/08/2026 Save the next evaluation frame of delayed scripts if( version >= 2 ) { xfer->xferUnsignedInt( &m_frameToEvaluateAt );