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
1 change: 1 addition & 0 deletions GeneralsMD/Code/GameEngine/Include/Common/TunnelTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class TunnelTracker : public MemoryPoolObject,
UnsignedInt getContainCount() const { return m_containListSize; }
Int getContainMax() const;
const ContainedItemsList* getContainedItemsList() const { return &m_containList; }
void swapContainedItemsList(ContainedItemsList& newList);

Bool isValidContainerFor(const Object* obj, Bool checkCapacity) const;
void addToContainList( Object *obj ); ///< add 'obj' to contain list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ Int TunnelTracker::getContainMax() const
return TheGlobalData->m_maxTunnelCapacity;
}

// ------------------------------------------------------------------------
void TunnelTracker::swapContainedItemsList(ContainedItemsList& newList)
{
m_containList.swap(newList);
m_containListSize = (Int)m_containList.size();
}

// ------------------------------------------------------------------------
void TunnelTracker::updateNemesis(const Object *target)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,27 @@ void TunnelContain::harmAndForceExitAllContained( DamageInfo *info )
//-------------------------------------------------------------------------------------------------
void TunnelContain::killAllContained( void )
{
// TheSuperHackers @bugfix xezon 04/06/2025 Empty the TunnelSystem's Contained Items List
// straight away to prevent a potential child call to catastrophically modify it as well.
// This scenario can happen if the killed occupant(s) apply deadly damage on death
// to the host container, which then attempts to remove all remaining occupants
// on the death of the host container. This is reproducible by shooting with
// Neutron Shells on a GLA Tunnel containing GLA Terrorists.

ContainedItemsList list;
Player *owningPlayer = getObject()->getControllingPlayer();
const ContainedItemsList *fullList = owningPlayer->getTunnelSystem()->getContainedItemsList();
owningPlayer->getTunnelSystem()->swapContainedItemsList(list);

Object *obj;
ContainedItemsList::const_iterator it;
it = (*fullList).begin();
while( it != (*fullList).end() )
ContainedItemsList::iterator it = list.begin();

while ( it != list.end() )
{
obj = *it;
it++;
Object *obj = *it++;
DEBUG_ASSERTCRASH( obj, ("Contain list must not contain NULL element"));

removeFromContain( obj, true );
obj->kill();

obj->kill();
}
}
//-------------------------------------------------------------------------------------------------
Expand Down
Loading