mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-23 08:22:55 +02:00
Fix elem.allocate corrupting LSI when running out of IDs
The can_move bits weren't guarded by newID != -1.
This commit is contained in:
@@ -2821,14 +2821,14 @@ int LuaScriptInterface::elements_allocate(lua_State * l)
|
|||||||
lua_pushinteger(l, newID);
|
lua_pushinteger(l, newID);
|
||||||
lua_setfield(l, -2, identifier.c_str());
|
lua_setfield(l, -2, identifier.c_str());
|
||||||
lua_pop(l, 1);
|
lua_pop(l, 1);
|
||||||
}
|
|
||||||
|
|
||||||
for (auto elem = 0; elem < PT_NUM; ++elem)
|
for (auto elem = 0; elem < PT_NUM; ++elem)
|
||||||
{
|
{
|
||||||
luacon_ci->custom_can_move[elem][newID] = 0;
|
luacon_ci->custom_can_move[elem][newID] = 0;
|
||||||
luacon_ci->custom_can_move[newID][elem] = 0;
|
luacon_ci->custom_can_move[newID][elem] = 0;
|
||||||
|
}
|
||||||
|
luacon_ci->custom_init_can_move();
|
||||||
}
|
}
|
||||||
luacon_ci->custom_init_can_move();
|
|
||||||
|
|
||||||
lua_pushinteger(l, newID);
|
lua_pushinteger(l, newID);
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user