Since WorldThingDestroyed is the reverse of WorldThingSpawned, it should ignore actors that didn't call PostBeginPlay.

This commit is contained in:
ZZYZX 2017-01-31 04:53:18 +02:00
commit 26d38e6527
3 changed files with 6 additions and 0 deletions

View file

@ -273,6 +273,10 @@ void E_WorldThingDestroyed(AActor* actor)
// don't call anything if actor was destroyed on PostBeginPlay/BeginPlay/whatever.
if (actor->ObjectFlags & OF_EuthanizeMe)
return;
// don't call anything for non-spawned things (i.e. those that were created, but immediately destroyed)
// this is because Destroyed should be reverse of Spawned. we don't want to catch random inventory give failures.
if (!(actor->ObjectFlags & OF_Spawned))
return;
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
handler->WorldThingDestroyed(actor);
}