From 077972cf6d6c21e7f34d23dc34cdd2495c0f1672 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Mon, 30 Mar 2026 20:58:16 +0200 Subject: [PATCH 1/4] bugfix(energy): Don't increase power production for disabled power plants on save game load Moved code. --- .../Source/GameLogic/Object/Object.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index d3db0e53e6b..8935d61e710 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4160,19 +4160,6 @@ void Object::xfer( Xfer *xfer ) // private status xfer->xferUnsignedByte( &m_privateStatus ); - // OK, now that we have xferred our status bits, it's safe to set the team... - if( xfer->getXferMode() == XFER_LOAD ) - { - Team *team = TheTeamFactory->findTeamByID( teamID ); - if( team == nullptr ) - { - DEBUG_CRASH(( "Object::xfer - Unable to load team" )); - throw SC_INVALID_DATA; - } - const Bool restoring = true; - setOrRestoreTeam( team, restoring ); - } - // geometry info xfer->xferSnapshot( &m_geometryInfo ); @@ -4224,6 +4211,19 @@ void Object::xfer( Xfer *xfer ) // disabled till frame xfer->xferUser( m_disabledTillFrame, sizeof( UnsignedInt ) * DISABLED_COUNT ); + // OK, now that we have xferred our status bits, it's safe to set the team... + if( xfer->getXferMode() == XFER_LOAD ) + { + Team *team = TheTeamFactory->findTeamByID( teamID ); + if( team == nullptr ) + { + DEBUG_CRASH(( "Object::xfer - Unable to load team" )); + throw SC_INVALID_DATA; + } + const Bool restoring = true; + setOrRestoreTeam( team, restoring ); + } + // special model condition until xfer->xferUnsignedInt( &m_smcUntil ); From 66a922b568ca3d13d587846ac5cc27cbea346771 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:01:17 +0200 Subject: [PATCH 2/4] Updated comment. --- GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 8935d61e710..bca9735beac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4211,7 +4211,7 @@ void Object::xfer( Xfer *xfer ) // disabled till frame xfer->xferUser( m_disabledTillFrame, sizeof( UnsignedInt ) * DISABLED_COUNT ); - // OK, now that we have xferred our status bits, it's safe to set the team... + // OK, now that we have xferred our status bits and disabled data, it's safe to set the team... if( xfer->getXferMode() == XFER_LOAD ) { Team *team = TheTeamFactory->findTeamByID( teamID ); From 6089070086713f8603207951925e9770fcd15af9 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sun, 12 Apr 2026 03:16:10 +0200 Subject: [PATCH 3/4] Added todo comment. --- GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index bca9735beac..32cc3621647 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -4212,6 +4212,7 @@ void Object::xfer( Xfer *xfer ) xfer->xferUser( m_disabledTillFrame, sizeof( UnsignedInt ) * DISABLED_COUNT ); // OK, now that we have xferred our status bits and disabled data, it's safe to set the team... + // TheSuperHackers @todo Refactor so that this code can be moved to loadPostProcess. if( xfer->getXferMode() == XFER_LOAD ) { Team *team = TheTeamFactory->findTeamByID( teamID ); From 98dc14ddc67e9b061ea3168e1a6ff710617a6226 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Sun, 12 Apr 2026 03:17:44 +0200 Subject: [PATCH 4/4] Replicated in Generals. --- .../Source/GameLogic/Object/Object.cpp | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index aa1f73afdb0..91e083b138a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3638,19 +3638,6 @@ void Object::xfer( Xfer *xfer ) // private status xfer->xferUnsignedByte( &m_privateStatus ); - // OK, now that we have xferred our status bits, it's safe to set the team... - if( xfer->getXferMode() == XFER_LOAD ) - { - Team *team = TheTeamFactory->findTeamByID( teamID ); - if( team == nullptr ) - { - DEBUG_CRASH(( "Object::xfer - Unable to load team" )); - throw SC_INVALID_DATA; - } - const Bool restoring = true; - setOrRestoreTeam( team, restoring ); - } - // geometry info xfer->xferSnapshot( &m_geometryInfo ); @@ -3693,6 +3680,20 @@ void Object::xfer( Xfer *xfer ) // disabled till frame xfer->xferUser( m_disabledTillFrame, sizeof( UnsignedInt ) * DISABLED_COUNT ); + // OK, now that we have xferred our status bits and disabled data, it's safe to set the team... + // TheSuperHackers @todo Refactor so that this code can be moved to loadPostProcess. + if( xfer->getXferMode() == XFER_LOAD ) + { + Team *team = TheTeamFactory->findTeamByID( teamID ); + if( team == nullptr ) + { + DEBUG_CRASH(( "Object::xfer - Unable to load team" )); + throw SC_INVALID_DATA; + } + const Bool restoring = true; + setOrRestoreTeam( team, restoring ); + } + // special model condition until xfer->xferUnsignedInt( &m_smcUntil );