Fix bad null check and dynamic ID calculation

This commit is contained in:
gsemaj 2021-05-09 09:36:50 -04:00
parent aa3dacc84b
commit d5fc36f877

View File

@ -62,11 +62,11 @@ static int npc_getSpeed(lua_State *state) {
CombatNPC *npc = grabNPC(state, 1);
// sanity check
if (npc != NULL)
if (npc == NULL)
return 0;
lua_pushinteger(state, npc->speed);
return 0;
return 1;
}
static const luaL_Reg npc_getters[] = {
@ -263,4 +263,4 @@ void LuaManager::NPC::init(lua_State *state) {
void LuaManager::NPC::push(lua_State *state, CombatNPC *npc) {
Entity::push(state, EntityRef(npc->appearanceData.iNPC_ID), LIBNAME);
}
}