Skip to content

Commit

Permalink
Fix and restrict level postprocessor instance
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRaveYard committed Nov 17, 2024
1 parent ab9b632 commit a4b2239
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/maploader/postprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DLevelPostProcessor>();
lc->loader = this;
lc->Level = Level;
for(auto cls : PClass::AllClasses)
{
if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelPostProcessor)))
Expand All @@ -87,8 +84,14 @@ void MapLoader::PostProcessLevel(FName checksum)
continue;
}

auto lc = static_cast<DLevelPostProcessor*>(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();
}
}
}
Expand Down

0 comments on commit a4b2239

Please sign in to comment.