Skip to content
Snippets Groups Projects
Commit b975eedd authored by James R.'s avatar James R.
Browse files

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.
parent 664f5fe5
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment