Skip to content

Commit

Permalink
[Minor] Fix ExtraWarheads always read the last setting (#1503)
Browse files Browse the repository at this point in the history
`ExtraWarheads.DetonationChances` and `ExtraWarheads.FullDetonation`.
  • Loading branch information
CrimRecya authored Jan 21, 2025
1 parent 5a9a0ef commit 750afeb
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/Ext/Bullet/Hooks.DetonateLogics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,29 +320,24 @@ DEFINE_HOOK(0x469AA4, BulletClass_Logics_Extras, 0x5)

if (size > i)
detonate = pWeaponExt->ExtraWarheads_DetonationChances[i] >= ScenarioClass::Instance->Random.RandomDouble();
if (size > 0)
else if (size > 0)
detonate = pWeaponExt->ExtraWarheads_DetonationChances[size - 1] >= ScenarioClass::Instance->Random.RandomDouble();

bool isFull = true;
size = pWeaponExt->ExtraWarheads_FullDetonation.size();

if (size > i)
isFull = pWeaponExt->ExtraWarheads_FullDetonation[i];
if (size > 0)
else if (size > 0)
isFull = pWeaponExt->ExtraWarheads_FullDetonation[size - 1];

if (detonate)
{
if (isFull)
{
WarheadTypeExt::DetonateAt(pWH, *coords, pThis->Owner, damage, pOwner, pThis->Target);
}
else
{
auto const pWHExt = WarheadTypeExt::ExtMap.Find(pWH);
pWHExt->DamageAreaWithTarget(*coords, damage, pThis->Owner, pWH, true, pOwner, abstract_cast<TechnoClass*>(pThis->Target));
}
}
if (!detonate)
continue;

if (isFull)
WarheadTypeExt::DetonateAt(pWH, *coords, pThis->Owner, damage, pOwner, pThis->Target);
else
WarheadTypeExt::ExtMap.Find(pWH)->DamageAreaWithTarget(*coords, damage, pThis->Owner, pWH, true, pOwner, abstract_cast<TechnoClass*>(pThis->Target));
}
}

Expand Down

0 comments on commit 750afeb

Please sign in to comment.