From 4212035729c11197f2502b6f50f1eb4e7bf17b89 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Mon, 24 Jul 2023 21:44:53 -0500 Subject: [PATCH] Fix errors due to declaring variables in switch bodies --- src/lua_maplib.c | 2 ++ src/lua_mobjlib.c | 2 ++ src/lua_playerlib.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 568a99b68..3d95cdb75 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -2822,6 +2822,7 @@ static int mapheaderinfo_get(lua_State *L) break; // TODO add support for reading numGradedMares and grades default: + { // Read custom vars now // (note: don't include the "LUA." in your lua scripts!) UINT8 j = 0; @@ -2832,6 +2833,7 @@ static int mapheaderinfo_get(lua_State *L) else lua_pushnil(L); } + } return 1; } diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 404af016a..851c569d2 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -1043,11 +1043,13 @@ static int mapthing_set(lua_State *L) mt->z = (INT16)luaL_checkinteger(L, 3); break; case mapthing_extrainfo: + { INT32 extrainfo = luaL_checkinteger(L, 3); if (extrainfo & ~15) return luaL_error(L, "mapthing_t extrainfo set %d out of range (%d - %d)", extrainfo, 0, 15); mt->extrainfo = (UINT8)extrainfo; break; + } case mapthing_tag: Tag_FSet(&mt->tags, (INT16)luaL_checkinteger(L, 3)); break; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index f0fa2ed94..510e481e6 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -1297,6 +1297,7 @@ static int player_set(lua_State *L) break; } case player_awayviewtics: + { INT32 tics = (INT32)luaL_checkinteger(L, 3); if (tics && !plr->awayviewmobj) // awayviewtics must ALWAYS have an awayviewmobj set!! P_SetTarget(&plr->awayviewmobj, plr->mo); // but since the script might set awayviewmobj immediately AFTER setting awayviewtics, use player mobj as filler for now. @@ -1308,6 +1309,7 @@ static int player_set(lua_State *L) } plr->awayviewtics = tics; break; + } case player_awayviewaiming: plr->awayviewaiming = luaL_checkangle(L, 3); break;