Skip to content

Commit

Permalink
Fix code for ExtraWarheads/ReturnWeapon concerning FirerHouse
Browse files Browse the repository at this point in the history
  • Loading branch information
Starkku committed Oct 31, 2024
1 parent 0449bdd commit 804eadb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Ext/Bullet/Hooks.DetonateLogics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ DEFINE_HOOK(0x469AA4, BulletClass_Logics_Extras, 0x5)
GET(BulletClass*, pThis, ESI);
GET_BASE(CoordStruct*, coords, 0x8);

auto const pOwner = pThis->Owner ? pThis->Owner->Owner : BulletExt::ExtMap.Find(pThis)->FirerHouse;

// Extra warheads
if (pThis->WeaponType)
{
Expand All @@ -308,7 +310,6 @@ DEFINE_HOOK(0x469AA4, BulletClass_Logics_Extras, 0x5)
for (size_t i = 0; i < pWeaponExt->ExtraWarheads.size(); i++)
{
auto const pWH = pWeaponExt->ExtraWarheads[i];
auto const pOwner = pThis->Owner ? pThis->Owner->Owner : BulletExt::ExtMap.Find(pThis)->FirerHouse;
int damage = defaultDamage;
size_t size = pWeaponExt->ExtraWarheads_DamageOverrides.size();

Expand Down Expand Up @@ -359,10 +360,8 @@ DEFINE_HOOK(0x469AA4, BulletClass_Logics_Extras, 0x5)
pWeapon->Damage, pWeapon->Warhead, pWeapon->Speed, pWeapon->Bright))
{
pBullet->WeaponType = pWeapon;
auto const pBulletExt = BulletExt::ExtMap.Find(pBullet);
pBulletExt->FirerHouse = pBulletExt->FirerHouse;

pBullet->MoveTo(pThis->Location, BulletVelocity::Empty);
BulletExt::ExtMap.Find(pBullet)->FirerHouse = pOwner;
}
}
}
Expand Down

0 comments on commit 804eadb

Please sign in to comment.