Skip to content

Commit a92886b

Browse files
authored
bugfix(energy): Don't increase power production for disabled power plants on save game load (#2508)
1 parent 73394e5 commit a92886b

2 files changed

Lines changed: 28 additions & 26 deletions

File tree

  • GeneralsMD/Code/GameEngine/Source/GameLogic/Object
  • Generals/Code/GameEngine/Source/GameLogic/Object

Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,19 +3638,6 @@ void Object::xfer( Xfer *xfer )
36383638
// private status
36393639
xfer->xferUnsignedByte( &m_privateStatus );
36403640

3641-
// OK, now that we have xferred our status bits, it's safe to set the team...
3642-
if( xfer->getXferMode() == XFER_LOAD )
3643-
{
3644-
Team *team = TheTeamFactory->findTeamByID( teamID );
3645-
if( team == nullptr )
3646-
{
3647-
DEBUG_CRASH(( "Object::xfer - Unable to load team" ));
3648-
throw SC_INVALID_DATA;
3649-
}
3650-
const Bool restoring = true;
3651-
setOrRestoreTeam( team, restoring );
3652-
}
3653-
36543641
// geometry info
36553642
xfer->xferSnapshot( &m_geometryInfo );
36563643

@@ -3693,6 +3680,20 @@ void Object::xfer( Xfer *xfer )
36933680
// disabled till frame
36943681
xfer->xferUser( m_disabledTillFrame, sizeof( UnsignedInt ) * DISABLED_COUNT );
36953682

3683+
// OK, now that we have xferred our status bits and disabled data, it's safe to set the team...
3684+
// TheSuperHackers @todo Refactor so that this code can be moved to loadPostProcess.
3685+
if( xfer->getXferMode() == XFER_LOAD )
3686+
{
3687+
Team *team = TheTeamFactory->findTeamByID( teamID );
3688+
if( team == nullptr )
3689+
{
3690+
DEBUG_CRASH(( "Object::xfer - Unable to load team" ));
3691+
throw SC_INVALID_DATA;
3692+
}
3693+
const Bool restoring = true;
3694+
setOrRestoreTeam( team, restoring );
3695+
}
3696+
36963697
// special model condition until
36973698
xfer->xferUnsignedInt( &m_smcUntil );
36983699

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4160,19 +4160,6 @@ void Object::xfer( Xfer *xfer )
41604160
// private status
41614161
xfer->xferUnsignedByte( &m_privateStatus );
41624162

4163-
// OK, now that we have xferred our status bits, it's safe to set the team...
4164-
if( xfer->getXferMode() == XFER_LOAD )
4165-
{
4166-
Team *team = TheTeamFactory->findTeamByID( teamID );
4167-
if( team == nullptr )
4168-
{
4169-
DEBUG_CRASH(( "Object::xfer - Unable to load team" ));
4170-
throw SC_INVALID_DATA;
4171-
}
4172-
const Bool restoring = true;
4173-
setOrRestoreTeam( team, restoring );
4174-
}
4175-
41764163
// geometry info
41774164
xfer->xferSnapshot( &m_geometryInfo );
41784165

@@ -4224,6 +4211,20 @@ void Object::xfer( Xfer *xfer )
42244211
// disabled till frame
42254212
xfer->xferUser( m_disabledTillFrame, sizeof( UnsignedInt ) * DISABLED_COUNT );
42264213

4214+
// OK, now that we have xferred our status bits and disabled data, it's safe to set the team...
4215+
// TheSuperHackers @todo Refactor so that this code can be moved to loadPostProcess.
4216+
if( xfer->getXferMode() == XFER_LOAD )
4217+
{
4218+
Team *team = TheTeamFactory->findTeamByID( teamID );
4219+
if( team == nullptr )
4220+
{
4221+
DEBUG_CRASH(( "Object::xfer - Unable to load team" ));
4222+
throw SC_INVALID_DATA;
4223+
}
4224+
const Bool restoring = true;
4225+
setOrRestoreTeam( team, restoring );
4226+
}
4227+
42274228
// special model condition until
42284229
xfer->xferUnsignedInt( &m_smcUntil );
42294230

0 commit comments

Comments
 (0)