From a4b2239ca67a6cf58f35130c3d1cb7dbe0fb3d23 Mon Sep 17 00:00:00 2001 From: RaveYard <29225776+MrRaveYard@users.noreply.github.com> Date: Fri, 14 Jun 2024 20:53:46 +0200 Subject: [PATCH] Fix and restrict level postprocessor instance --- src/maploader/postprocessor.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/maploader/postprocessor.cpp b/src/maploader/postprocessor.cpp index e94e7d4d74e..c430ce6a5fd 100644 --- a/src/maploader/postprocessor.cpp +++ b/src/maploader/postprocessor.cpp @@ -56,19 +56,16 @@ class DLevelPostProcessor : public DObject { - DECLARE_ABSTRACT_CLASS(DLevelPostProcessor, DObject) + DECLARE_CLASS(DLevelPostProcessor, DObject) public: MapLoader *loader; FLevelLocals *Level; }; -IMPLEMENT_CLASS(DLevelPostProcessor, true, false); +IMPLEMENT_CLASS(DLevelPostProcessor, false, false); void MapLoader::PostProcessLevel(FName checksum) { - auto lc = Create(); - lc->loader = this; - lc->Level = Level; for(auto cls : PClass::AllClasses) { if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelPostProcessor))) @@ -87,8 +84,14 @@ void MapLoader::PostProcessLevel(FName checksum) continue; } + auto lc = static_cast(cls->CreateNew()); + lc->loader = this; + lc->Level = Level; + VMValue param[] = { lc, checksum.GetIndex(), &Level->MapName }; VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0); + + lc->Destroy(); } } }