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;
// 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;
}

View file

@ -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;

View file

@ -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;