mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-21 02:51:37 +00:00
- added validation of LevelCompatibility.Apply() signature
# Conflicts: # src/compatibility.cpp
This commit is contained in:
parent
ce0b4b1ead
commit
f340d411c3
1 changed files with 14 additions and 3 deletions
|
@ -56,6 +56,7 @@
|
|||
#include "g_levellocals.h"
|
||||
#include "vm.h"
|
||||
#include "actor.h"
|
||||
#include "types.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -356,11 +357,21 @@ void SetCompatibilityParams(FName checksum)
|
|||
if (cls->IsDescendantOf(RUNTIME_CLASS(DLevelCompatibility)))
|
||||
{
|
||||
PFunction *const func = dyn_cast<PFunction>(cls->FindSymbol("Apply", false));
|
||||
if (func != nullptr)
|
||||
if (func == nullptr)
|
||||
{
|
||||
VMValue param[] = { lc, checksum.GetIndex(), &level.MapName };
|
||||
VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
|
||||
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 };
|
||||
VMCall(func->Variants[0].Implementation, param, 3, nullptr, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue