- Implemented ZScript abstract functions

This commit is contained in:
Player701 2020-10-10 11:24:49 +03:00 committed by Christoph Oelckers
commit 761dea8640
9 changed files with 82 additions and 22 deletions

View file

@ -284,6 +284,13 @@ static bool CanJit(VMScriptFunction *func)
int VMScriptFunction::FirstScriptCall(VMFunction *func, VMValue *params, int numparams, VMReturn *ret, int numret)
{
// [Player701] Check that we aren't trying to call an abstract function.
// This shouldn't happen normally, but if it does, let's catch this explicitly
// rather than let GZDoom crash.
if (func->VarFlags & VARF_Abstract)
{
ThrowAbortException(X_OTHER, "attempt to call abstract function %s.", func->PrintableName.GetChars());
}
#ifdef HAVE_VM_JIT
if (vm_jit && CanJit(static_cast<VMScriptFunction*>(func)))
{
@ -654,7 +661,11 @@ CVMAbortException::CVMAbortException(EVMAbortException reason, const char *morei
}
if (moreinfo != nullptr)
{
AppendMessage(" ");
// [Player701] avoid double space
if (reason != X_OTHER)
{
AppendMessage(" ");
}
size_t len = strlen(m_Message);
myvsnprintf(m_Message + len, MAX_ERRORTEXT - len, moreinfo, ap);
}