Fix errors due to declaring variables in switch bodies

This commit is contained in:
GoldenTails 2023-07-24 21:44:53 -05:00
parent 3a52e6deb2
commit 4212035729
3 changed files with 6 additions and 0 deletions

View file

@ -2822,6 +2822,7 @@ static int mapheaderinfo_get(lua_State *L)
break; break;
// TODO add support for reading numGradedMares and grades // TODO add support for reading numGradedMares and grades
default: default:
{
// Read custom vars now // Read custom vars now
// (note: don't include the "LUA." in your lua scripts!) // (note: don't include the "LUA." in your lua scripts!)
UINT8 j = 0; UINT8 j = 0;
@ -2832,6 +2833,7 @@ static int mapheaderinfo_get(lua_State *L)
else else
lua_pushnil(L); lua_pushnil(L);
} }
}
return 1; return 1;
} }

View file

@ -1043,11 +1043,13 @@ static int mapthing_set(lua_State *L)
mt->z = (INT16)luaL_checkinteger(L, 3); mt->z = (INT16)luaL_checkinteger(L, 3);
break; break;
case mapthing_extrainfo: case mapthing_extrainfo:
{
INT32 extrainfo = luaL_checkinteger(L, 3); INT32 extrainfo = luaL_checkinteger(L, 3);
if (extrainfo & ~15) if (extrainfo & ~15)
return luaL_error(L, "mapthing_t extrainfo set %d out of range (%d - %d)", extrainfo, 0, 15); return luaL_error(L, "mapthing_t extrainfo set %d out of range (%d - %d)", extrainfo, 0, 15);
mt->extrainfo = (UINT8)extrainfo; mt->extrainfo = (UINT8)extrainfo;
break; break;
}
case mapthing_tag: case mapthing_tag:
Tag_FSet(&mt->tags, (INT16)luaL_checkinteger(L, 3)); Tag_FSet(&mt->tags, (INT16)luaL_checkinteger(L, 3));
break; break;

View file

@ -1297,6 +1297,7 @@ static int player_set(lua_State *L)
break; break;
} }
case player_awayviewtics: case player_awayviewtics:
{
INT32 tics = (INT32)luaL_checkinteger(L, 3); INT32 tics = (INT32)luaL_checkinteger(L, 3);
if (tics && !plr->awayviewmobj) // awayviewtics must ALWAYS have an awayviewmobj set!! 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. 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; plr->awayviewtics = tics;
break; break;
}
case player_awayviewaiming: case player_awayviewaiming:
plr->awayviewaiming = luaL_checkangle(L, 3); plr->awayviewaiming = luaL_checkangle(L, 3);
break; break;