From a33c2743a156927fa325a81a904f2180f3de1958 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 31 May 2022 19:33:18 -0400 Subject: [PATCH] Clear precipprops in Lua more automatically --- src/lua_infolib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 88cb32ed9..1aaa207de 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -1797,9 +1797,8 @@ static int lib_setPrecipProps(lua_State *L) return luaL_error(L, "Do not alter precipprops in CMD building code!"); // clear the precipprops to start with, in case of missing table elements - // done manually because we do not want to clear name - props->type = MT_NULL; - props->effects = 0; + // make sure we do not clear the name + memset(props + sizeof(props->name), 0, sizeof(precipprops_t) - sizeof(props->name)); lua_pushnil(L); while (lua_next(L, 1)) {