mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- added validation of LevelCompatibility.Apply() signature
This commit is contained in:
parent
bc88ceea94
commit
73f46089cc
1 changed files with 14 additions and 3 deletions
|
@ -54,6 +54,7 @@
|
||||||
#include "actor.h"
|
#include "actor.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "maploader/maploader.h"
|
#include "maploader/maploader.h"
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -365,13 +366,23 @@ void MapLoader::SetCompatibilityParams(FName checksum)
|
||||||
if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelCompatibility)))
|
if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelCompatibility)))
|
||||||
{
|
{
|
||||||
PFunction *const func = dyn_cast<PFunction>(cls->FindSymbol("Apply", false));
|
PFunction *const func = dyn_cast<PFunction>(cls->FindSymbol("Apply", false));
|
||||||
if (func != nullptr)
|
if (func == nullptr)
|
||||||
{
|
{
|
||||||
|
Printf("Missing 'Apply' method in class '%s', level compatibility object ignored\n", cls->TypeName.GetChars());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto argTypes = func->Variants[0].Proto->ArgumentTypes;
|
||||||
|
if (argTypes.Size() != 3 || argTypes[1] != TypeName || argTypes[2] != TypeString)
|
||||||
|
{
|
||||||
|
Printf("Wrong signature of 'Apply' method in class '%s', level compatibility object ignored\n", cls->TypeName.GetChars());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
VMValue param[] = { lc, checksum.GetIndex(), &Level->MapName };
|
VMValue param[] = { lc, checksum.GetIndex(), &Level->MapName };
|
||||||
VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
|
VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DLevelCompatibility, OffsetSectorPlane)
|
DEFINE_ACTION_FUNCTION(DLevelCompatibility, OffsetSectorPlane)
|
||||||
|
|
Loading…
Reference in a new issue