Constrain brushx and brushy values (#716)
This commit is contained in:
parent
9188f7bf8b
commit
49963980e6
@ -445,9 +445,21 @@ int LuaScriptInterface::tpt_newIndex(lua_State *l)
|
|||||||
luaL_error(l, "Invalid tool identifier: %s", lua_tostring(l, 3));
|
luaL_error(l, "Invalid tool identifier: %s", lua_tostring(l, 3));
|
||||||
}
|
}
|
||||||
else if (!key.compare("brushx"))
|
else if (!key.compare("brushx"))
|
||||||
c->SetBrushSize(ui::Point(luaL_checkinteger(l, 3), m->GetBrush()->GetRadius().Y));
|
{
|
||||||
|
int brushx = luaL_checkinteger(l, 3);
|
||||||
|
if (brushx < 0 || brushx >= XRES)
|
||||||
|
luaL_error(l, "Invalid brush width");
|
||||||
|
|
||||||
|
c->SetBrushSize(ui::Point(brushx, m->GetBrush()->GetRadius().Y));
|
||||||
|
}
|
||||||
else if (!key.compare("brushy"))
|
else if (!key.compare("brushy"))
|
||||||
c->SetBrushSize(ui::Point(m->GetBrush()->GetRadius().X, luaL_checkinteger(l, 3)));
|
{
|
||||||
|
int brushy = luaL_checkinteger(l, 3);
|
||||||
|
if (brushy < 0 || brushy >= YRES)
|
||||||
|
luaL_error(l, "Invalid brush height");
|
||||||
|
|
||||||
|
c->SetBrushSize(ui::Point(m->GetBrush()->GetRadius().X, brushy));
|
||||||
|
}
|
||||||
else if (!key.compare("brushID"))
|
else if (!key.compare("brushID"))
|
||||||
m->SetBrushID(luaL_checkinteger(l, 3));
|
m->SetBrushID(luaL_checkinteger(l, 3));
|
||||||
else if (!key.compare("decoSpace"))
|
else if (!key.compare("decoSpace"))
|
||||||
|
Loading…
Reference in New Issue
Block a user