Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Generals/Code/GameEngine/Include/GameLogic/GameLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@ class GameLogic : public SubsystemInterface, public Snapshot
void xferObjectTOC( Xfer *xfer ); ///< save/load object TOC for current state of map
void prepareLogicForObjectLoad(); ///< prepare engine for object data from game file

#if RTS_GENERALS && defined(_MSC_VER) && _MSC_VER < 1300
public:
Bool m_onUnitProducedZeroInit;
#endif

};

// INLINE /////////////////////////////////////////////////////////////////////////////////////////
Expand Down
10 changes: 10 additions & 0 deletions Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,16 @@ void AIPlayer::onUnitProduced( Object *factory, Object *unit )
// To keep retail compatibility it needs to be set true in VS6 builds.
#if defined(_MSC_VER) && _MSC_VER < 1300
Bool supplyTruck = true;

#if RTS_GENERALS
// A special initialization case for the call site in SpawnBehavior::createSpawn
// to mimic the initialization behavior in the retail Generals binary.
if (TheGameLogic->m_onUnitProducedZeroInit)
{
supplyTruck = false;
}
#endif

#else
Bool supplyTruck = false;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,14 @@ Bool SpawnBehavior::createSpawn()
newSpawn = TheThingFactory->newObject( m_spawnTemplate, parent->getTeam() ); // just a little worried about this...

// Count this unit towards our score.
#if RTS_GENERALS && defined(_MSC_VER) && _MSC_VER < 1300
// TheSuperHackers @info Set m_onUnitProducedZeroInit to true so it can be used in AIPlayer::onUnitProduced.
TheGameLogic->m_onUnitProducedZeroInit = true;
newSpawn->getControllingPlayer()->onUnitCreated(parent, newSpawn);
TheGameLogic->m_onUnitProducedZeroInit = false;
#else
newSpawn->getControllingPlayer()->onUnitCreated(parent, newSpawn);
#endif

// Gee, this is new...
// Now, we can have a list of template names.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ GameLogic::GameLogic()
m_loadingMap = FALSE;
m_loadingSave = FALSE;
m_clearingGameData = FALSE;

#if RTS_GENERALS && defined(_MSC_VER) && _MSC_VER < 1300
m_onUnitProducedZeroInit = false;
#endif
}

//-------------------------------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameLogic/GameLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ class GameLogic : public SubsystemInterface, public Snapshot
void xferObjectTOC( Xfer *xfer ); ///< save/load object TOC for current state of map
void prepareLogicForObjectLoad(); ///< prepare engine for object data from game file

#if RTS_GENERALS && defined(_MSC_VER) && _MSC_VER < 1300
public:
Bool m_onUnitProducedZeroInit;
#endif

};

// INLINE /////////////////////////////////////////////////////////////////////////////////////////
Expand Down
10 changes: 10 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,16 @@ void AIPlayer::onUnitProduced( Object *factory, Object *unit )
// To keep retail compatibility it needs to be set true in VS6 builds.
#if defined(_MSC_VER) && _MSC_VER < 1300
Bool supplyTruck = true;

#if RTS_GENERALS
// A special initialization case for the call site in SpawnBehavior::createSpawn
// to mimic the initialization behavior in the retail Generals binary.
if (TheGameLogic->m_onUnitProducedZeroInit)
{
supplyTruck = false;
}
#endif

#else
Bool supplyTruck = false;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,14 @@ Bool SpawnBehavior::createSpawn()
newSpawn = TheThingFactory->newObject( m_spawnTemplate, parent->getTeam() ); // just a little worried about this...

// Count this unit towards our score.
#if RTS_GENERALS && defined(_MSC_VER) && _MSC_VER < 1300
Comment thread
Caball009 marked this conversation as resolved.
// TheSuperHackers @info Set m_onUnitProducedZeroInit to true so it can be used in AIPlayer::onUnitProduced.
TheGameLogic->m_onUnitProducedZeroInit = true;
newSpawn->getControllingPlayer()->onUnitCreated(parent, newSpawn);
TheGameLogic->m_onUnitProducedZeroInit = false;
#else
newSpawn->getControllingPlayer()->onUnitCreated(parent, newSpawn);
#endif

// Gee, this is new...
// Now, we can have a list of template names.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ GameLogic::GameLogic()
m_loadingSave = FALSE;
m_clearingGameData = FALSE;
m_quitToDesktopAfterMatch = FALSE;

#if RTS_GENERALS && defined(_MSC_VER) && _MSC_VER < 1300
m_onUnitProducedZeroInit = false;
#endif
}

//-------------------------------------------------------------------------------------------------
Expand Down
Loading