mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Fix two bugs with Lua MIN, MAX Plus cvars
1) Any cvar without MIN, MAX would be disallowed; now check that at least one of those values is actually present. 2) Handle value index properly when shifting array.
This commit is contained in:
parent
664f5fe5b1
commit
b975eedd9b
1 changed files with 3 additions and 3 deletions
|
@ -400,23 +400,23 @@ static int lib_cvRegisterVar(lua_State *L)
|
|||
{
|
||||
memmove(&cvpv[2], &cvpv[0],
|
||||
i * sizeof *cvpv);
|
||||
i += 2;
|
||||
}
|
||||
cvpv[n].strvalue = MINMAX[n];
|
||||
minmax_unset &= ~(1 << n);
|
||||
}
|
||||
else
|
||||
{
|
||||
n = i;
|
||||
n = i++;
|
||||
cvpv[n].strvalue = Z_StrDup(strval);
|
||||
}
|
||||
|
||||
cvpv[n].value = (INT32)lua_tonumber(L, 6);
|
||||
|
||||
i++;
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
if (minmax_unset)
|
||||
if (minmax_unset && minmax_unset != 3)
|
||||
FIELDERROR("PossibleValue", "custom PossibleValue table requires requires both MIN and MAX keys if one is present");
|
||||
|
||||
cvpv[i].value = 0;
|
||||
|
|
Loading…
Reference in a new issue