- fixed: AActor::GetModifiedDamage must account for the inventory items to get destroyed in its scripted subfunctions.

This commit is contained in:
Christoph Oelckers 2020-06-12 23:11:45 +02:00
parent a3c100a2ed
commit e47f016b23

View file

@ -7359,14 +7359,15 @@ void AActor::ClearCounters()
int AActor::GetModifiedDamage(FName damagetype, int damage, bool passive, AActor *inflictor, AActor *source, int flags) int AActor::GetModifiedDamage(FName damagetype, int damage, bool passive, AActor *inflictor, AActor *source, int flags)
{ {
auto inv = Inventory; auto inv = Inventory;
while (inv != nullptr) while (inv != nullptr && !(inv->ObjectFlags & OF_EuthanizeMe))
{ {
auto nextinv = inv->Inventory;
IFVIRTUALPTRNAME(inv, NAME_Inventory, ModifyDamage) IFVIRTUALPTRNAME(inv, NAME_Inventory, ModifyDamage)
{ {
VMValue params[8] = { (DObject*)inv, damage, damagetype.GetIndex(), &damage, passive, inflictor, source, flags }; VMValue params[8] = { (DObject*)inv, damage, damagetype.GetIndex(), &damage, passive, inflictor, source, flags };
VMCall(func, params, 8, nullptr, 0); VMCall(func, params, 8, nullptr, 0);
} }
inv = inv->Inventory; inv = nextinv;
} }
return damage; return damage;
} }