- block StaticPointerSubstitution for non-player objects.

The only safe use of this function is to swap out PlayerPawns for morphing or respawning.
This commit is contained in:
Christoph Oelckers 2020-03-16 09:21:37 +01:00
parent a50a5101bc
commit b7970ed763
1 changed files with 3 additions and 0 deletions

View File

@ -491,6 +491,9 @@ void DObject::StaticPointerSubstitution (AActor *old, AActor *notOld)
if (old == nullptr) return; if (old == nullptr) return;
// This is only allowed to replace players. For everything else the results are undefined.
if (!old->IsKindOf(NAME_PlayerPawn) || (notOld != nullptr && !notOld->IsKindOf(NAME_PlayerPawn))) return;
// Go through all objects. // Go through all objects.
i = 0;DObject *last=0; i = 0;DObject *last=0;
for (probe = GC::Root; probe != NULL; probe = probe->ObjNext) for (probe = GC::Root; probe != NULL; probe = probe->ObjNext)