Typecast p to INT16
Since the enum type is implementation-defined, and could be either signed or unsigned.
This commit is contained in:
parent
7731bf6b09
commit
9f7613ef6d
|
@ -628,19 +628,19 @@ static int power_get(lua_State *L)
|
||||||
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
||||||
powertype_t p = luaL_checkinteger(L, 2);
|
powertype_t p = luaL_checkinteger(L, 2);
|
||||||
if (p >= NUMPOWERS)
|
if (p >= NUMPOWERS)
|
||||||
return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", p);
|
return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", (INT16)p);
|
||||||
lua_pushinteger(L, powers[p]);
|
lua_pushinteger(L, powers[p]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// powers, p, value -> powers[p] = value
|
// powers, p, value -> powers[p] = value
|
||||||
static int power_set(lua_State *L)
|
static int power_set(lua_State *L){
|
||||||
{
|
|
||||||
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
UINT16 *powers = *((UINT16 **)luaL_checkudata(L, 1, META_POWERS));
|
||||||
powertype_t p = luaL_checkinteger(L, 2);
|
powertype_t p = luaL_checkinteger(L, 2);
|
||||||
UINT16 i = (UINT16)luaL_checkinteger(L, 3);
|
UINT16 i = (UINT16)luaL_checkinteger(L, 3);
|
||||||
if (p >= NUMPOWERS)
|
if (p >= NUMPOWERS)
|
||||||
return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", p);
|
return luaL_error(L, LUA_QL("powertype_t") " cannot be %d", (INT16)p);
|
||||||
if (hud_running)
|
if (hud_running)
|
||||||
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
return luaL_error(L, "Do not alter player_t in HUD rendering code!");
|
||||||
powers[p] = i;
|
powers[p] = i;
|
||||||
|
|
Loading…
Reference in a new issue