Skip to content

Commit a725544

Browse files
committed
Addressed feedback.
1 parent cebb0a5 commit a725544

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ void OpenContain::orderAllPassengersToHackInternet( CommandSourceType commandSou
14671467
//-------------------------------------------------------------------------------------------------
14681468
void OpenContain::processDamageToContainedInternal(Object* const* objects, size_t size, Real percentDamage)
14691469
{
1470-
const bool isBurnedDeathToUnits = getOpenContainModuleData()->m_isBurnedDeathToUnits;
1470+
const DeathType deathType = getOpenContainModuleData()->m_isBurnedDeathToUnits ? DEATH_BURNED : DEATH_NORMAL;
14711471
const bool killContained = percentDamage == 1.0f;
14721472

14731473
for (size_t i = 0; i < size; ++i)
@@ -1479,7 +1479,7 @@ void OpenContain::processDamageToContainedInternal(Object* const* objects, size_
14791479

14801480
DamageInfo damageInfo;
14811481
damageInfo.in.m_damageType = DAMAGE_UNRESISTABLE;
1482-
damageInfo.in.m_deathType = isBurnedDeathToUnits ? DEATH_BURNED : DEATH_NORMAL;
1482+
damageInfo.in.m_deathType = deathType;
14831483
damageInfo.in.m_sourceID = getObject()->getID();
14841484
damageInfo.in.m_amount = damage;
14851485
object->attemptDamage( &damageInfo );
@@ -1495,7 +1495,7 @@ void OpenContain::processDamageToContainedInternal(Object* const* objects, size_
14951495
}
14961496
}
14971497

1498-
#endif
1498+
#endif // RETAIL_COMPATIBLE_CRC
14991499

15001500
//-------------------------------------------------------------------------------------------------
15011501
void OpenContain::processDamageToContained(Real percentDamage)
@@ -1505,7 +1505,8 @@ void OpenContain::processDamageToContained(Real percentDamage)
15051505
DEBUG_ASSERTCRASH(m_containListSize == m_containList.size(), ("contain list size doesn't match size of container"));
15061506

15071507
// TheSuperHackers @bugfix Caball009 11/03/2026 Use a temporary copy of the contain list to iterate over,
1508-
// because Object::attemptDamage may remove some or all elements from the list while iterating over it, which may be unsafe.
1508+
// because causing damage to the occupants may remove some or all elements from the list
1509+
// while iterating over it, which may be unsafe.
15091510

15101511
constexpr const UnsignedInt smallContainerSize = 16;
15111512
if (m_containListSize < smallContainerSize)
@@ -1525,13 +1526,14 @@ void OpenContain::processDamageToContained(Real percentDamage)
15251526
#else
15261527

15271528
// TheSuperHackers @bugfix xezon 05/06/2025 Temporarily empty the m_containList
1528-
// because Object::attemptDamage may remove some or all elements from the list while iterating over it, which may be unsafe.
1529+
// because causing damage to the occupants may remove some or all elements from the list
1530+
// while iterating over it, which may be unsafe.
15291531

15301532
// Caveat: While the m_containList is empty, it will not be possible to apply damage
15311533
// on death of a unit to another unit in the host container. If this functionality
15321534
// is desired, then this implementation needs to be revisited.
15331535

1534-
const bool isBurnedDeathToUnits = getOpenContainModuleData()->m_isBurnedDeathToUnits;
1536+
const DeathType deathType = getOpenContainModuleData()->m_isBurnedDeathToUnits ? DEATH_BURNED : DEATH_NORMAL;
15351537
const bool killContained = percentDamage == 1.0f;
15361538

15371539
ContainedItemsList list;
@@ -1551,7 +1553,7 @@ void OpenContain::processDamageToContained(Real percentDamage)
15511553

15521554
DamageInfo damageInfo;
15531555
damageInfo.in.m_damageType = DAMAGE_UNRESISTABLE;
1554-
damageInfo.in.m_deathType = isBurnedDeathToUnits ? DEATH_BURNED : DEATH_NORMAL;
1556+
damageInfo.in.m_deathType = deathType;
15551557
damageInfo.in.m_sourceID = getObject()->getID();
15561558
damageInfo.in.m_amount = damage;
15571559
object->attemptDamage( &damageInfo );

0 commit comments

Comments
 (0)