Change SDKHooks CanBeAutoBalanced to only MRES_SUPERCEDE if the return changes.
This commit is contained in:
parent
818e1e4e18
commit
2812f227b7
@ -916,10 +916,6 @@ bool SDKHooks::Hook_LevelInit(char const *pMapName, char const *pMapEntities, ch
|
|||||||
bool SDKHooks::Hook_CanBeAutobalanced()
|
bool SDKHooks::Hook_CanBeAutobalanced()
|
||||||
{
|
{
|
||||||
CBaseEntity *pPlayer = META_IFACEPTR(CBaseEntity);
|
CBaseEntity *pPlayer = META_IFACEPTR(CBaseEntity);
|
||||||
int entity = gamehelpers->EntityToBCompatRef(pPlayer);
|
|
||||||
|
|
||||||
bool origRet = SH_MCALL(pPlayer, CanBeAutobalanced)();
|
|
||||||
bool newRet = origRet;
|
|
||||||
|
|
||||||
CVTableHook vhook(pPlayer);
|
CVTableHook vhook(pPlayer);
|
||||||
ke::Vector<CVTableList *> &vtablehooklist = g_HookList[SDKHook_CanBeAutobalanced];
|
ke::Vector<CVTableList *> &vtablehooklist = g_HookList[SDKHook_CanBeAutobalanced];
|
||||||
@ -930,11 +926,16 @@ bool SDKHooks::Hook_CanBeAutobalanced()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int entity = gamehelpers->EntityToBCompatRef(pPlayer);
|
||||||
|
|
||||||
|
bool origRet = SH_MCALL(pPlayer, CanBeAutobalanced)();
|
||||||
|
bool newRet = origRet;
|
||||||
|
|
||||||
ke::Vector<IPluginFunction *> callbackList;
|
ke::Vector<IPluginFunction *> callbackList;
|
||||||
PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
|
PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
|
||||||
for (entry = 0; entry < callbackList.length(); ++entry)
|
for (entry = 0; entry < callbackList.length(); ++entry)
|
||||||
{
|
{
|
||||||
cell_t res;
|
cell_t res = origRet;
|
||||||
IPluginFunction *callback = callbackList[entry];
|
IPluginFunction *callback = callbackList[entry];
|
||||||
callback->PushCell(entity);
|
callback->PushCell(entity);
|
||||||
callback->PushCell(origRet);
|
callback->PushCell(origRet);
|
||||||
@ -943,14 +944,17 @@ bool SDKHooks::Hook_CanBeAutobalanced()
|
|||||||
// Only update our new ret if different from original
|
// Only update our new ret if different from original
|
||||||
// (so if multiple plugins returning different answers,
|
// (so if multiple plugins returning different answers,
|
||||||
// the one(s) that changed it win)
|
// the one(s) that changed it win)
|
||||||
if ((res != 0) != origRet)
|
if (res != origRet)
|
||||||
newRet = !origRet;
|
newRet = !origRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newRet != origRet)
|
||||||
|
RETURN_META_VALUE(MRES_SUPERCEDE, newRet);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_SUPERCEDE, newRet);
|
RETURN_META_VALUE(MRES_IGNORED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDKHooks::Hook_EndTouch(CBaseEntity *pOther)
|
void SDKHooks::Hook_EndTouch(CBaseEntity *pOther)
|
||||||
|
Loading…
Reference in New Issue
Block a user