Rename SDKHooks function and variable to be friendlier.

This commit is contained in:
Kyle Sanderson 2014-07-30 15:34:51 -07:00
parent ba0406930d
commit ab72841704

View File

@ -439,7 +439,7 @@ FeatureStatus SDKHooks::GetFeatureStatus(FeatureType type, const char *name)
* Functions * Functions
*/ */
static void CopyEntityVector(const ke::Vector<HookList> &source, ke::Vector<IPluginFunction *> &destination, int entity) static void PopulateCallbackList(const ke::Vector<HookList> &source, ke::Vector<IPluginFunction *> &destination, int entity)
{ {
destination.ensure(8); /* Skip trivial allocations as AMTL uses length<<1. */ destination.ensure(8); /* Skip trivial allocations as AMTL uses length<<1. */
for (size_t iter = 0; iter < source.length(); ++iter) for (size_t iter = 0; iter < source.length(); ++iter)
@ -479,11 +479,11 @@ cell_t SDKHooks::Call(CBaseEntity *pEnt, SDKHookType type, CBaseEntity *pOther)
int entity = gamehelpers->EntityToBCompatRef(pEnt); int entity = gamehelpers->EntityToBCompatRef(pEnt);
int other = gamehelpers->EntityToBCompatRef(pOther); int other = gamehelpers->EntityToBCompatRef(pOther);
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCell(other); callback->PushCell(other);
@ -926,11 +926,11 @@ void SDKHooks::Hook_FireBulletsPost(const FireBulletsInfo_t &info)
const char *weapon = pInfo->GetWeaponName(); const char *weapon = pInfo->GetWeaponName();
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCell(info.m_iShots); callback->PushCell(info.m_iShots);
callback->PushString(weapon?weapon:""); callback->PushString(weapon?weapon:"");
@ -964,11 +964,11 @@ int SDKHooks::Hook_GetMaxHealth()
cell_t res = Pl_Continue; cell_t res = Pl_Continue;
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCellByRef(&new_max); callback->PushCellByRef(&new_max);
callback->Execute(&res); callback->Execute(&res);
@ -1017,11 +1017,11 @@ int SDKHooks::Hook_OnTakeDamage(CTakeDamageInfoHack &info)
cell_t res, ret = Pl_Continue; cell_t res, ret = Pl_Continue;
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCellByRef(&attacker); callback->PushCellByRef(&attacker);
callback->PushCellByRef(&inflictor); callback->PushCellByRef(&inflictor);
@ -1095,11 +1095,11 @@ int SDKHooks::Hook_OnTakeDamagePost(CTakeDamageInfoHack &info)
int entity = gamehelpers->EntityToBCompatRef(pEntity); int entity = gamehelpers->EntityToBCompatRef(pEntity);
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCell(info.GetAttacker()); callback->PushCell(info.GetAttacker());
callback->PushCell(info.GetInflictor()); callback->PushCell(info.GetInflictor());
@ -1164,11 +1164,11 @@ bool SDKHooks::Hook_Reload()
int entity = gamehelpers->EntityToBCompatRef(pEntity); int entity = gamehelpers->EntityToBCompatRef(pEntity);
cell_t res = Pl_Continue; cell_t res = Pl_Continue;
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->Execute(&res); callback->Execute(&res);
} }
@ -1198,11 +1198,11 @@ bool SDKHooks::Hook_ReloadPost()
int entity = gamehelpers->EntityToBCompatRef(pEntity); int entity = gamehelpers->EntityToBCompatRef(pEntity);
cell_t origreturn = META_RESULT_ORIG_RET(bool) ? 1 : 0; cell_t origreturn = META_RESULT_ORIG_RET(bool) ? 1 : 0;
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCell(origreturn); callback->PushCell(origreturn);
callback->Execute(NULL); callback->Execute(NULL);
@ -1241,11 +1241,11 @@ bool SDKHooks::Hook_ShouldCollide(int collisionGroup, int contentsMask)
cell_t origRet = ((META_RESULT_STATUS >= MRES_OVERRIDE)?(META_RESULT_OVERRIDE_RET(bool)):(META_RESULT_ORIG_RET(bool))) ? 1 : 0; cell_t origRet = ((META_RESULT_STATUS >= MRES_OVERRIDE)?(META_RESULT_OVERRIDE_RET(bool)):(META_RESULT_ORIG_RET(bool))) ? 1 : 0;
cell_t res = 0; cell_t res = 0;
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCell(collisionGroup); callback->PushCell(collisionGroup);
callback->PushCell(contentsMask); callback->PushCell(contentsMask);
@ -1285,11 +1285,11 @@ void SDKHooks::Hook_Spawn()
int entity = gamehelpers->EntityToBCompatRef(pEntity); int entity = gamehelpers->EntityToBCompatRef(pEntity);
cell_t res = Pl_Continue; cell_t res = Pl_Continue;
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->Execute(&res); callback->Execute(&res);
} }
@ -1379,11 +1379,11 @@ void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir,
int ammotype = info.GetAmmoType(); int ammotype = info.GetAmmoType();
cell_t res, ret = Pl_Continue; cell_t res, ret = Pl_Continue;
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCellByRef(&attacker); callback->PushCellByRef(&attacker);
callback->PushCellByRef(&inflictor); callback->PushCellByRef(&inflictor);
@ -1453,11 +1453,11 @@ void SDKHooks::Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vec
int entity = gamehelpers->EntityToBCompatRef(pEntity); int entity = gamehelpers->EntityToBCompatRef(pEntity);
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCell(info.GetAttacker()); callback->PushCell(info.GetAttacker());
callback->PushCell(info.GetInflictor()); callback->PushCell(info.GetInflictor());
@ -1493,11 +1493,11 @@ void SDKHooks::Hook_Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
int caller = gamehelpers->EntityToBCompatRef(pCaller); int caller = gamehelpers->EntityToBCompatRef(pCaller);
cell_t ret = Pl_Continue; cell_t ret = Pl_Continue;
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCell(activator); callback->PushCell(activator);
callback->PushCell(caller); callback->PushCell(caller);
@ -1532,11 +1532,11 @@ void SDKHooks::Hook_UsePost(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
int activator = gamehelpers->EntityToBCompatRef(pActivator); int activator = gamehelpers->EntityToBCompatRef(pActivator);
int caller = gamehelpers->EntityToBCompatRef(pCaller); int caller = gamehelpers->EntityToBCompatRef(pCaller);
ke::Vector<IPluginFunction *> pawnlist; ke::Vector<IPluginFunction *> callbackList;
CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity);
for (entry = 0; entry < pawnlist.length(); ++entry) for (entry = 0; entry < callbackList.length(); ++entry)
{ {
IPluginFunction *callback = pawnlist[entry]; IPluginFunction *callback = callbackList[entry];
callback->PushCell(entity); callback->PushCell(entity);
callback->PushCell(activator); callback->PushCell(activator);
callback->PushCell(caller); callback->PushCell(caller);