Skip to content

Commit 985c57d

Browse files
committed
bugfix: Prevent tunnel healing from stacking
1 parent 48054ec commit 985c57d

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

Generals/Code/GameEngine/Include/Common/TunnelTracker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class TunnelTracker : public MemoryPoolObject,
8484
std::list< ObjectID > m_xferContainList;///< for loading of m_containList during post processing
8585
Int m_containListSize; ///< size of the contain list
8686
UnsignedInt m_tunnelCount; ///< How many tunnels have registered so we know when we should kill our contain list
87+
UnsignedInt m_lastHealFrame; ///< Ensure we don't heal more than once per frame
8788

8889
ObjectID m_curNemesisID; ///< If we have team(s) guarding a tunnel network system, this is one of the current targets.
8990
UnsignedInt m_nemesisTimestamp; ///< We only keep nemesis for a couple of seconds.

Generals/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,13 @@ void TunnelTracker::destroyObject( Object *obj, void * )
254254
// heal all the objects within the tunnel system using the iterateContained function
255255
void TunnelTracker::healObjects(Real frames)
256256
{
257+
#if !RETAIL_COMPATIBLE_CRC
258+
if (m_lastHealFrame == TheGameLogic->getFrame())
259+
return; // Only heal objects once per frame.
260+
#endif
261+
257262
iterateContained(healObject, &frames, FALSE);
263+
m_lastHealFrame = TheGameLogic->getFrame();
258264
}
259265

260266
// ------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class TunnelTracker : public MemoryPoolObject,
8484
std::list< ObjectID > m_xferContainList;///< for loading of m_containList during post processing
8585
Int m_containListSize; ///< size of the contain list
8686
UnsignedInt m_tunnelCount; ///< How many tunnels have registered so we know when we should kill our contain list
87+
UnsignedInt m_lastHealFrame; ///< Ensure we don't heal more than once per frame
8788

8889
ObjectID m_curNemesisID; ///< If we have team(s) guarding a tunnel network system, this is one of the current targets.
8990
UnsignedInt m_nemesisTimestamp; ///< We only keep nemesis for a couple of seconds.

GeneralsMD/Code/GameEngine/Source/Common/RTS/TunnelTracker.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,13 @@ void TunnelTracker::destroyObject( Object *obj, void * )
255255
// heal all the objects within the tunnel system using the iterateContained function
256256
void TunnelTracker::healObjects(Real frames)
257257
{
258+
#if !RETAIL_COMPATIBLE_CRC
259+
if (m_lastHealFrame == TheGameLogic->getFrame())
260+
return; // Only heal objects once per frame.
261+
#endif
262+
258263
iterateContained(healObject, &frames, FALSE);
264+
m_lastHealFrame = TheGameLogic->getFrame();
259265
}
260266

261267
// ------------------------------------------------------------------------

0 commit comments

Comments
 (0)