- validate statnum before spawning an actor.

This commit is contained in:
Christoph Oelckers 2022-12-21 10:54:02 +01:00
parent da0b429751
commit 918c75cb6e

View file

@ -85,6 +85,7 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor*
info = spawnMap.CheckKey(s_pn);
if (info) clstype = static_cast<PClassActor*>(info->cls);
}
if (s_stat < 0) s_stat = clstype ? GetDefaultByType(clstype)->spr.statnum : 0;
auto act = static_cast<DDukeActor*>(InsertActor(clstype? clstype : RUNTIME_CLASS(DDukeActor), whatsectp, s_stat));
if (act == nullptr) return nullptr;