mirror of https://github.com/ZDoom/gzdoom.git
- fixed: DLevelScript always initialized the first 3 local variables, even if less were allocated.
SVN r3101 (trunk)
This commit is contained in:
parent
789c937635
commit
7db7886a0e
|
@ -1964,6 +1964,7 @@ DLevelScript::~DLevelScript ()
|
||||||
{
|
{
|
||||||
if (localvars != NULL)
|
if (localvars != NULL)
|
||||||
delete[] localvars;
|
delete[] localvars;
|
||||||
|
localvars = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DLevelScript::Unlink ()
|
void DLevelScript::Unlink ()
|
||||||
|
@ -6725,9 +6726,18 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
|
||||||
script = num;
|
script = num;
|
||||||
numlocalvars = code->VarCount;
|
numlocalvars = code->VarCount;
|
||||||
localvars = new SDWORD[code->VarCount];
|
localvars = new SDWORD[code->VarCount];
|
||||||
localvars[0] = arg0;
|
if (code->VarCount > 0)
|
||||||
localvars[1] = arg1;
|
{
|
||||||
localvars[2] = arg2;
|
localvars[0] = arg0;
|
||||||
|
if (code->VarCount > 1)
|
||||||
|
{
|
||||||
|
localvars[1] = arg1;
|
||||||
|
if (code->VarCount > 2)
|
||||||
|
{
|
||||||
|
localvars[2] = arg2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
memset (localvars+code->ArgCount, 0, (code->VarCount-code->ArgCount)*sizeof(SDWORD));
|
memset (localvars+code->ArgCount, 0, (code->VarCount-code->ArgCount)*sizeof(SDWORD));
|
||||||
pc = module->GetScriptAddress (code);
|
pc = module->GetScriptAddress (code);
|
||||||
activator = who;
|
activator = who;
|
||||||
|
|
Loading…
Reference in New Issue