Added a bunch of I_Asserts to lua_hooklib.c relating to mobj types just in case

This commit is contained in:
Monster Iestyn 2017-12-17 20:59:24 +00:00
parent ec10367856
commit c7cd64583d
1 changed files with 14 additions and 0 deletions

View File

@ -231,6 +231,8 @@ boolean LUAh_MobjHook(mobj_t *mo, enum hook which)
if (!gL || !(hooksAvailable[which/8] & (1<<(which%8))))
return false;
I_Assert(mo->type < NUMMOBJTYPES);
lua_settop(gL, 0);
// Look for all generic mobj hooks
@ -406,6 +408,8 @@ UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which)
if (!gL || !(hooksAvailable[which/8] & (1<<(which%8))))
return 0;
I_Assert(thing1->type < NUMMOBJTYPES);
lua_settop(gL, 0);
// Look for all generic mobj collision hooks
@ -479,6 +483,8 @@ boolean LUAh_MobjThinker(mobj_t *mo)
if (!gL || !(hooksAvailable[hook_MobjThinker/8] & (1<<(hook_MobjThinker%8))))
return false;
I_Assert(mo->type < NUMMOBJTYPES);
lua_settop(gL, 0);
// Look for all generic mobj thinker hooks
@ -532,6 +538,8 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher)
if (!gL || !(hooksAvailable[hook_TouchSpecial/8] & (1<<(hook_TouchSpecial%8))))
return 0;
I_Assert(special->type < NUMMOBJTYPES);
lua_settop(gL, 0);
// Look for all generic touch special hooks
@ -595,6 +603,8 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
if (!gL || !(hooksAvailable[hook_ShouldDamage/8] & (1<<(hook_ShouldDamage%8))))
return 0;
I_Assert(target->type < NUMMOBJTYPES);
lua_settop(gL, 0);
// Look for all generic should damage hooks
@ -676,6 +686,8 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
if (!gL || !(hooksAvailable[hook_MobjDamage/8] & (1<<(hook_MobjDamage%8))))
return 0;
I_Assert(target->type < NUMMOBJTYPES);
lua_settop(gL, 0);
// Look for all generic mobj damage hooks
@ -747,6 +759,8 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source)
if (!gL || !(hooksAvailable[hook_MobjDeath/8] & (1<<(hook_MobjDeath%8))))
return 0;
I_Assert(target->type < NUMMOBJTYPES);
lua_settop(gL, 0);
// Look for all generic mobj death hooks