From bafdd7d6ca2dd32dbf78a077edb2f924351c192e Mon Sep 17 00:00:00 2001 From: Ahmet Fatih Cengiz <37782582+afc-afc0@users.noreply.github.com> Date: Sun, 12 Apr 2026 13:56:27 -0400 Subject: [PATCH 1/3] bugfix(save): Fix in-flight DumbProjectile detonating instantly on save game load --- .../Object/Behavior/DumbProjectileBehavior.cpp | 17 +++++++++++++++-- .../Object/Behavior/DumbProjectileBehavior.cpp | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 9684b87cdcd..30724bf3184 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -696,13 +696,14 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Added m_currentFlightPathStep for mid-flight save/load */ // ------------------------------------------------------------------------------------------------ void DumbProjectileBehavior::xfer( Xfer *xfer ) { // version - XferVersion currentVersion = 1; + XferVersion currentVersion = 2; XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -753,6 +754,12 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) // lifespan frame xfer->xferUnsignedInt( &m_lifespanFrame ); + // TheSuperHackers @bugfix Serialize current flight path step so projectiles can resume mid-flight on load. + if( version >= 2 ) + { + xfer->xferInt( &m_currentFlightPathStep ); + } + } // ------------------------------------------------------------------------------------------------ @@ -764,4 +771,10 @@ void DumbProjectileBehavior::loadPostProcess() // extend base class UpdateModule::loadPostProcess(); + // TheSuperHackers @bugfix Rebuild flight path on load to prevent immediate detonation of in-flight projectiles. + if( m_flightPathSegments > 0 ) + { + calcFlightPath( false ); + } + } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 1c5fcb77dc8..9b106564d3a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -747,13 +747,14 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: Added m_currentFlightPathStep for mid-flight save/load */ // ------------------------------------------------------------------------------------------------ void DumbProjectileBehavior::xfer( Xfer *xfer ) { // version - XferVersion currentVersion = 1; + XferVersion currentVersion = 2; XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -804,6 +805,12 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) // lifespan frame xfer->xferUnsignedInt( &m_lifespanFrame ); + // TheSuperHackers @bugfix Serialize current flight path step so projectiles can resume mid-flight on load. + if( version >= 2 ) + { + xfer->xferInt( &m_currentFlightPathStep ); + } + } // ------------------------------------------------------------------------------------------------ @@ -815,4 +822,10 @@ void DumbProjectileBehavior::loadPostProcess() // extend base class UpdateModule::loadPostProcess(); + // TheSuperHackers @bugfix Rebuild flight path on load to prevent immediate detonation of in-flight projectiles. + if( m_flightPathSegments > 0 ) + { + calcFlightPath( false ); + } + } From f60a31377c8a53246cd7befccf1a569b428522c1 Mon Sep 17 00:00:00 2001 From: Ahmet Fatih Cengiz <37782582+afc-afc0@users.noreply.github.com> Date: Sun, 12 Apr 2026 15:20:51 -0400 Subject: [PATCH 2/3] bugfix(save): Add RETAIL_COMPATIBLE_XFER_SAVE guard and fix version comment format --- .../GameLogic/Object/Behavior/DumbProjectileBehavior.cpp | 6 +++++- .../GameLogic/Object/Behavior/DumbProjectileBehavior.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 30724bf3184..f31448a9cc5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -697,13 +697,17 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: Added m_currentFlightPathStep for mid-flight save/load */ + * 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load. */ // ------------------------------------------------------------------------------------------------ void DumbProjectileBehavior::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 9b106564d3a..6f0d6084259 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -748,13 +748,17 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: Added m_currentFlightPathStep for mid-flight save/load */ + * 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load. */ // ------------------------------------------------------------------------------------------------ void DumbProjectileBehavior::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE + XferVersion currentVersion = 1; +#else XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); From bae71901d1d8e821ab6e6c3b7fd6988c0081ac5d Mon Sep 17 00:00:00 2001 From: Ahmet Fatih Cengiz <37782582+afc-afc0@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:20:03 -0400 Subject: [PATCH 3/3] Address PR reviews --- .../GameLogic/Object/Behavior/DumbProjectileBehavior.cpp | 5 ++--- .../GameLogic/Object/Behavior/DumbProjectileBehavior.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index f31448a9cc5..7c4bc633863 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -697,7 +697,8 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load. */ + * 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load. + */ // ------------------------------------------------------------------------------------------------ void DumbProjectileBehavior::xfer( Xfer *xfer ) { @@ -758,7 +759,6 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) // lifespan frame xfer->xferUnsignedInt( &m_lifespanFrame ); - // TheSuperHackers @bugfix Serialize current flight path step so projectiles can resume mid-flight on load. if( version >= 2 ) { xfer->xferInt( &m_currentFlightPathStep ); @@ -775,7 +775,6 @@ void DumbProjectileBehavior::loadPostProcess() // extend base class UpdateModule::loadPostProcess(); - // TheSuperHackers @bugfix Rebuild flight path on load to prevent immediate detonation of in-flight projectiles. if( m_flightPathSegments > 0 ) { calcFlightPath( false ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 6f0d6084259..9b782240938 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -748,7 +748,8 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) /** Xfer method * Version Info: * 1: Initial version - * 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load. */ + * 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load. + */ // ------------------------------------------------------------------------------------------------ void DumbProjectileBehavior::xfer( Xfer *xfer ) { @@ -809,7 +810,6 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) // lifespan frame xfer->xferUnsignedInt( &m_lifespanFrame ); - // TheSuperHackers @bugfix Serialize current flight path step so projectiles can resume mid-flight on load. if( version >= 2 ) { xfer->xferInt( &m_currentFlightPathStep ); @@ -826,7 +826,6 @@ void DumbProjectileBehavior::loadPostProcess() // extend base class UpdateModule::loadPostProcess(); - // TheSuperHackers @bugfix Rebuild flight path on load to prevent immediate detonation of in-flight projectiles. if( m_flightPathSegments > 0 ) { calcFlightPath( false );