From ab728417044300ec6a1a77fe4dc1466bf13bc2c2 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Wed, 30 Jul 2014 15:34:51 -0700 Subject: [PATCH] Rename SDKHooks function and variable to be friendlier. --- extensions/sdkhooks/extension.cpp | 106 +++++++++++++++--------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/extensions/sdkhooks/extension.cpp b/extensions/sdkhooks/extension.cpp index 0b7de86a..646776c7 100644 --- a/extensions/sdkhooks/extension.cpp +++ b/extensions/sdkhooks/extension.cpp @@ -439,7 +439,7 @@ FeatureStatus SDKHooks::GetFeatureStatus(FeatureType type, const char *name) * Functions */ -static void CopyEntityVector(const ke::Vector &source, ke::Vector &destination, int entity) +static void PopulateCallbackList(const ke::Vector &source, ke::Vector &destination, int entity) { destination.ensure(8); /* Skip trivial allocations as AMTL uses length<<1. */ 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 other = gamehelpers->EntityToBCompatRef(pOther); - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCell(other); @@ -926,11 +926,11 @@ void SDKHooks::Hook_FireBulletsPost(const FireBulletsInfo_t &info) const char *weapon = pInfo->GetWeaponName(); - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCell(info.m_iShots); callback->PushString(weapon?weapon:""); @@ -964,11 +964,11 @@ int SDKHooks::Hook_GetMaxHealth() cell_t res = Pl_Continue; - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCellByRef(&new_max); callback->Execute(&res); @@ -1017,11 +1017,11 @@ int SDKHooks::Hook_OnTakeDamage(CTakeDamageInfoHack &info) cell_t res, ret = Pl_Continue; - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCellByRef(&attacker); callback->PushCellByRef(&inflictor); @@ -1095,11 +1095,11 @@ int SDKHooks::Hook_OnTakeDamagePost(CTakeDamageInfoHack &info) int entity = gamehelpers->EntityToBCompatRef(pEntity); - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCell(info.GetAttacker()); callback->PushCell(info.GetInflictor()); @@ -1164,11 +1164,11 @@ bool SDKHooks::Hook_Reload() int entity = gamehelpers->EntityToBCompatRef(pEntity); cell_t res = Pl_Continue; - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->Execute(&res); } @@ -1198,11 +1198,11 @@ bool SDKHooks::Hook_ReloadPost() int entity = gamehelpers->EntityToBCompatRef(pEntity); cell_t origreturn = META_RESULT_ORIG_RET(bool) ? 1 : 0; - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCell(origreturn); 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 res = 0; - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCell(collisionGroup); callback->PushCell(contentsMask); @@ -1285,11 +1285,11 @@ void SDKHooks::Hook_Spawn() int entity = gamehelpers->EntityToBCompatRef(pEntity); cell_t res = Pl_Continue; - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->Execute(&res); } @@ -1379,11 +1379,11 @@ void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, int ammotype = info.GetAmmoType(); cell_t res, ret = Pl_Continue; - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCellByRef(&attacker); callback->PushCellByRef(&inflictor); @@ -1453,11 +1453,11 @@ void SDKHooks::Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vec int entity = gamehelpers->EntityToBCompatRef(pEntity); - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCell(info.GetAttacker()); callback->PushCell(info.GetInflictor()); @@ -1493,11 +1493,11 @@ void SDKHooks::Hook_Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE int caller = gamehelpers->EntityToBCompatRef(pCaller); cell_t ret = Pl_Continue; - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCell(activator); callback->PushCell(caller); @@ -1532,11 +1532,11 @@ void SDKHooks::Hook_UsePost(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T int activator = gamehelpers->EntityToBCompatRef(pActivator); int caller = gamehelpers->EntityToBCompatRef(pCaller); - ke::Vector pawnlist; - CopyEntityVector(vtablehooklist[entry]->hooks, pawnlist, entity); - for (entry = 0; entry < pawnlist.length(); ++entry) + ke::Vector callbackList; + PopulateCallbackList(vtablehooklist[entry]->hooks, callbackList, entity); + for (entry = 0; entry < callbackList.length(); ++entry) { - IPluginFunction *callback = pawnlist[entry]; + IPluginFunction *callback = callbackList[entry]; callback->PushCell(entity); callback->PushCell(activator); callback->PushCell(caller);