- fixed initialization of default parameters in dynamically created function calls like in the MENUDEF parser

This commit is contained in:
Christoph Oelckers 2018-11-23 09:34:38 +01:00
parent 6f397854d0
commit 80c6505eee

View file

@ -633,7 +633,10 @@ int VMCallWithDefaults(VMFunction *func, TArray<VMValue> &params, VMReturn *resu
{ {
auto oldp = params.Size(); auto oldp = params.Size();
params.Resize(func->DefaultArgs.Size()); params.Resize(func->DefaultArgs.Size());
memcpy(&params[oldp], &func->DefaultArgs[oldp], (params.Size() - oldp) * sizeof(VMValue)); for (unsigned i = oldp; i < params.Size(); i++)
{
params[i] = func->DefaultArgs[i];
}
} }
return VMCall(func, params.Data(), params.Size(), results, numresults); return VMCall(func, params.Data(), params.Size(), results, numresults);
} }