mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Fix bad null check and dynamic ID calculation
This commit is contained in:
parent
aa3dacc84b
commit
d5fc36f877
@ -62,11 +62,11 @@ static int npc_getSpeed(lua_State *state) {
|
|||||||
CombatNPC *npc = grabNPC(state, 1);
|
CombatNPC *npc = grabNPC(state, 1);
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (npc != NULL)
|
if (npc == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
lua_pushinteger(state, npc->speed);
|
lua_pushinteger(state, npc->speed);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const luaL_Reg npc_getters[] = {
|
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) {
|
void LuaManager::NPC::push(lua_State *state, CombatNPC *npc) {
|
||||||
Entity::push(state, EntityRef(npc->appearanceData.iNPC_ID), LIBNAME);
|
Entity::push(state, EntityRef(npc->appearanceData.iNPC_ID), LIBNAME);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user