mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Update hamsandwich module project files and use AMTL.
This commit is contained in:
parent
4f776ee56b
commit
4f3d335ab4
@ -8,7 +8,7 @@ binary.compiler.defines += [
|
||||
]
|
||||
|
||||
binary.sources = [
|
||||
'sdk/amxxmodule.cpp',
|
||||
'../../public/sdk/amxxmodule.cpp',
|
||||
'amxx_api.cpp',
|
||||
'config_parser.cpp',
|
||||
'hook_callbacks.cpp',
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
#include <sh_stack.h>
|
||||
#include "DataHandler.h"
|
||||
|
||||
#include "ham_const.h"
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
CStack< Data * > ReturnStack;
|
||||
CStack< Data * > OrigReturnStack;
|
||||
CStack< CVector< Data * > * > ParamStack;
|
||||
CStack< ke::Vector< Data * > * > ParamStack;
|
||||
CStack< int * > ReturnStatus;
|
||||
#define CHECK_STACK(__STACK__) \
|
||||
if ( ( __STACK__ ).size() <= 0) \
|
||||
@ -180,10 +180,10 @@ static cell AMX_NATIVE_CALL SetHamReturnString(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL SetHamParamInteger(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
@ -200,10 +200,10 @@ static cell AMX_NATIVE_CALL SetHamParamTraceResult(AMX *amx, cell *params)
|
||||
return 0;
|
||||
}
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
@ -214,10 +214,10 @@ static cell AMX_NATIVE_CALL SetHamParamTraceResult(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL SetHamParamFloat(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1] || params[1] < 1)
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1] || params[1] < 1)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
@ -228,10 +228,10 @@ static cell AMX_NATIVE_CALL SetHamParamFloat(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL SetHamParamVector(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
@ -242,10 +242,10 @@ static cell AMX_NATIVE_CALL SetHamParamVector(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL SetHamParamEntity(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
@ -256,10 +256,10 @@ static cell AMX_NATIVE_CALL SetHamParamEntity(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL SetHamParamString(AMX *amx, cell *params)
|
||||
{
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec=ParamStack.front();
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
ke::Vector<Data *> *vec=ParamStack.front();
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
Data *dat=vec->at(params[1] - 1);
|
||||
@ -277,11 +277,11 @@ static cell AMX_NATIVE_CALL SetHamParamItemInfo(AMX *amx, cell *params)
|
||||
}
|
||||
|
||||
CHECK_STACK(ParamStack);
|
||||
CVector<Data *> *vec = ParamStack.front();
|
||||
ke::Vector<Data *> *vec = ParamStack.front();
|
||||
|
||||
if (vec->size() < (unsigned)params[1])
|
||||
if (vec->length() < (unsigned)params[1])
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->size());
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
#define RETURNHANDLER_H
|
||||
|
||||
#include "ham_utils.h"
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
#include <sh_stack.h>
|
||||
|
||||
enum
|
||||
{
|
||||
@ -184,7 +184,7 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
String *str=reinterpret_cast<String *>(m_data);
|
||||
ke::AString *str=reinterpret_cast<ke::AString *>(m_data);
|
||||
|
||||
cell *i=data;
|
||||
size_t len=0;
|
||||
@ -203,7 +203,7 @@ public:
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
str->assign(temp);
|
||||
*str = temp;
|
||||
|
||||
delete[] temp;
|
||||
|
||||
@ -330,7 +330,7 @@ public:
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
const char *i=(reinterpret_cast<String *>(m_data)->c_str());
|
||||
const char *i=(reinterpret_cast<ke::AString *>(m_data)->chars());
|
||||
|
||||
while (len-- &&
|
||||
(*data++=*i++)!='\0')
|
||||
@ -369,6 +369,6 @@ public:
|
||||
|
||||
extern CStack< Data * > ReturnStack;
|
||||
extern CStack< Data * > OrigReturnStack;
|
||||
extern CStack< CVector< Data * > * > ParamStack;
|
||||
extern CStack< ke::Vector< Data * > * > ParamStack;
|
||||
extern CStack< int * > ReturnStatus;
|
||||
#endif
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
HLSDK = ../../../hlsdk
|
||||
MM_ROOT = ../../../metamod/metamod
|
||||
PUBLIC_ROOT = ../../public
|
||||
|
||||
#####################################
|
||||
### EDIT BELOW FOR OTHER PROJECTS ###
|
||||
@ -14,7 +15,7 @@ MM_ROOT = ../../../metamod/metamod
|
||||
|
||||
PROJECT = hamsandwich
|
||||
|
||||
OBJECTS = sdk/amxxmodule.cpp amxx_api.cpp config_parser.cpp hook_callbacks.cpp hook_native.cpp \
|
||||
OBJECTS = amxxmodule.cpp amxx_api.cpp config_parser.cpp hook_callbacks.cpp hook_native.cpp \
|
||||
srvcmd.cpp call_funcs.cpp hook_create.cpp DataHandler.cpp pdata.cpp hook_specialbot.cpp
|
||||
|
||||
##############################################
|
||||
@ -30,8 +31,9 @@ CPP_OSX = clang
|
||||
|
||||
LINK =
|
||||
|
||||
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared \
|
||||
-I$(HLSDK)/pm_shared -I$(HLSDK)/public -I$(MM_ROOT) -Isdk
|
||||
INCLUDE = -I. -I$(PUBLIC_ROOT) -I$(PUBLIC_ROOT)/sdk -I$(PUBLIC_ROOT)/amtl \
|
||||
-I$(HLSDK) -I$(HLSDK)/public -I$(HLSDK)/common -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/pm_shared\
|
||||
-I$(MM_ROOT)
|
||||
|
||||
################################################
|
||||
### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
|
||||
@ -106,7 +108,7 @@ $(BIN_DIR)/%.o: %.cpp
|
||||
|
||||
all:
|
||||
mkdir -p $(BIN_DIR)
|
||||
mkdir -p $(BIN_DIR)/sdk
|
||||
ln -sf $(PUBLIC_ROOT)/sdk/amxxmodule.cpp
|
||||
$(MAKE) -f $(MAKEFILE_NAME) $(PROJECT)
|
||||
|
||||
$(PROJECT): $(OBJ_BIN)
|
||||
@ -119,6 +121,5 @@ default: all
|
||||
|
||||
clean:
|
||||
rm -rf $(BIN_DIR)/*.o
|
||||
rm -rf $(BIN_DIR)/sdk/*.o
|
||||
rm -f $(BIN_DIR)/$(BINARY)
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <extdll.h>
|
||||
|
||||
#include "NEW_Util.h"
|
||||
#include "CVector.h"
|
||||
#include <am-vector.h>
|
||||
#include "forward.h"
|
||||
#include "hook.h"
|
||||
#include "ham_const.h"
|
||||
@ -28,7 +28,7 @@
|
||||
edict_t *NEW_FirstEdict;
|
||||
bool NEW_Initialized;
|
||||
|
||||
extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern ke::Vector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern CHamSpecialBotHandler SpecialbotHandler;
|
||||
|
||||
extern AMX_NATIVE_INFO RegisterNatives[];
|
||||
@ -106,17 +106,11 @@ void HamCommand(void);
|
||||
|
||||
void OnPluginsUnloaded(void)
|
||||
{
|
||||
|
||||
CVector <Hook *>::iterator end;
|
||||
for (int i = 0; i < HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
for (size_t i = 0; i < HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
end=hooks[i].end();
|
||||
|
||||
for (CVector<Hook*>::iterator j=hooks[i].begin();
|
||||
j!=end;
|
||||
++j)
|
||||
for (size_t j = 0; j < hooks[i].length(); ++j)
|
||||
{
|
||||
delete (*j);
|
||||
delete hooks[i].at(j);
|
||||
}
|
||||
hooks[i].clear();
|
||||
}
|
||||
|
@ -16,13 +16,12 @@
|
||||
#include "offsets.h"
|
||||
#include "ham_utils.h"
|
||||
#include "hooklist.h"
|
||||
|
||||
#include "CVector.h"
|
||||
#include "forward.h"
|
||||
#include "hook.h"
|
||||
#include "CString.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
|
||||
extern CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern ke::Vector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
|
||||
void FailPlugin(AMX *amx, int id, int err, const char *reason);
|
||||
|
||||
@ -34,13 +33,9 @@ inline void *GetFunction(void *pthis, int id, bool &istramp)
|
||||
void *func=GetVTableEntry(pthis, hooklist[id].vtid, Offsets.GetBase());
|
||||
|
||||
// Check to see if it's a trampoline
|
||||
CVector<Hook *>::iterator end=hooks[id].end();
|
||||
|
||||
for (CVector<Hook *>::iterator i=hooks[id].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[id].length(); ++i)
|
||||
{
|
||||
if (func==(*i)->tramp)
|
||||
if (func == hooks[id].at(i)->tramp)
|
||||
{
|
||||
istramp=true;
|
||||
return func;
|
||||
@ -57,17 +52,13 @@ inline void *_GetFunction(void *pthis, int id)
|
||||
void *func=ivtbl[hooklist[id].vtid];
|
||||
|
||||
// Iterate through the hooks for the id, see if the function is found
|
||||
CVector<Hook *>::iterator end=hooks[id].end();
|
||||
|
||||
for (CVector<Hook *>::iterator i=hooks[id].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[id].length(); ++i)
|
||||
{
|
||||
// If the function points to a trampoline, then return the original
|
||||
// function.
|
||||
if (func==(*i)->tramp)
|
||||
if (func == hooks[id].at(i)->tramp)
|
||||
{
|
||||
return (*i)->func;
|
||||
return hooks[id].at(i)->func;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "forward.h"
|
||||
#include "Trampolines.h"
|
||||
#include <am-vector.h>
|
||||
|
||||
#define ALIGN(ar) ((intptr_t)ar & ~(sysconf(_SC_PAGESIZE)-1))
|
||||
|
||||
@ -25,8 +26,8 @@
|
||||
class Hook
|
||||
{
|
||||
public:
|
||||
CVector<Forward *> pre; // pre forwards
|
||||
CVector<Forward *> post; // post forwards
|
||||
ke::Vector<Forward *> pre; // pre forwards
|
||||
ke::Vector<Forward *> post; // post forwards
|
||||
void *func; // original function
|
||||
void **vtable; // vtable of the original location
|
||||
int entry; // vtable entry of the function
|
||||
@ -86,21 +87,16 @@ public:
|
||||
|
||||
delete[] ent;
|
||||
|
||||
CVector<Forward *>::iterator end=pre.end();
|
||||
for (size_t i = 0; i < pre.length(); ++i)
|
||||
{
|
||||
delete pre.at(i);
|
||||
}
|
||||
|
||||
for (CVector<Forward *>::iterator i=pre.begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < post.length(); ++i)
|
||||
{
|
||||
delete (*i);
|
||||
}
|
||||
end=post.end();
|
||||
for (CVector<Forward *>::iterator i=post.begin();
|
||||
i!=end;
|
||||
++i)
|
||||
{
|
||||
delete (*i);
|
||||
delete post.at(i);
|
||||
}
|
||||
|
||||
pre.clear();
|
||||
post.clear();
|
||||
}
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include <extdll.h>
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "CVector.h"
|
||||
#include "CString.h"
|
||||
#include "sh_stack.h"
|
||||
#include <am-vector.h>
|
||||
#include <am-string.h>
|
||||
#include <sh_stack.h>
|
||||
|
||||
#include "hook.h"
|
||||
#include "forward.h"
|
||||
@ -48,29 +48,28 @@ extern bool gDoForwards;
|
||||
// Parameter value pushes
|
||||
#define MAKE_VECTOR() \
|
||||
int iThis=PrivateToIndex(pthis); \
|
||||
CVector<Data *> *__vec=new CVector<Data *>; \
|
||||
ke::Vector<Data *> *__vec=new ke::Vector<Data *>; \
|
||||
ParamStack.push(__vec); \
|
||||
P_CBASE(pthis, iThis)
|
||||
|
||||
#define P_BOOL(___PARAM) __vec->push_back(new Data(RET_BOOL, (void *) & (___PARAM)));
|
||||
#define P_INT(___PARAM) __vec->push_back(new Data(RET_INTEGER, (void *) & (___PARAM)));
|
||||
#define P_SHORT(___PARAM) __vec->push_back(new Data(RET_SHORT, (void *) & (___PARAM)));
|
||||
#define P_FLOAT(___PARAM) __vec->push_back(new Data(RET_FLOAT, (void *) & (___PARAM)));
|
||||
#define P_VECTOR(___PARAM) __vec->push_back(new Data(RET_VECTOR, (void *) & (___PARAM)));
|
||||
#define P_STR(___PARAM) __vec->push_back(new Data(RET_STRING, (void *) & (___PARAM)));
|
||||
#define P_CBASE(__PARAM, __INDEX) __vec->push_back(new Data(RET_CBASE, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_ENTVAR(__PARAM, __INDEX) __vec->push_back(new Data(RET_ENTVAR, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_EDICT(__PARAM, __INDEX) __vec->push_back(new Data(RET_EDICT, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_TRACE(__PARAM) __vec->push_back(new Data(RET_TRACE, (void *) (__PARAM)));
|
||||
#define P_PTRVECTOR(__PARAM) __vec->push_back(new Data(RET_VECTOR, (void *) (__PARAM)));
|
||||
#define P_PTRFLOAT(__PARAM) __vec->push_back(new Data(RET_FLOAT, (void *) (__PARAM)));
|
||||
#define P_ITEMINFO(__PARAM) __vec->push_back(new Data(RET_ITEMINFO, (void *) & (__PARAM)));
|
||||
#define P_BOOL(___PARAM) __vec->append(new Data(RET_BOOL, (void *) & (___PARAM)));
|
||||
#define P_INT(___PARAM) __vec->append(new Data(RET_INTEGER, (void *) & (___PARAM)));
|
||||
#define P_SHORT(___PARAM) __vec->append(new Data(RET_SHORT, (void *) & (___PARAM)));
|
||||
#define P_FLOAT(___PARAM) __vec->append(new Data(RET_FLOAT, (void *) & (___PARAM)));
|
||||
#define P_VECTOR(___PARAM) __vec->append(new Data(RET_VECTOR, (void *) & (___PARAM)));
|
||||
#define P_STR(___PARAM) __vec->append(new Data(RET_STRING, (void *) & (___PARAM)));
|
||||
#define P_CBASE(__PARAM, __INDEX) __vec->append(new Data(RET_CBASE, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_ENTVAR(__PARAM, __INDEX) __vec->append(new Data(RET_ENTVAR, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_EDICT(__PARAM, __INDEX) __vec->append(new Data(RET_EDICT, (void *) & (__PARAM), reinterpret_cast<int *>(& (__INDEX))));
|
||||
#define P_TRACE(__PARAM) __vec->append(new Data(RET_TRACE, (void *) (__PARAM)));
|
||||
#define P_PTRVECTOR(__PARAM) __vec->append(new Data(RET_VECTOR, (void *) (__PARAM)));
|
||||
#define P_PTRFLOAT(__PARAM) __vec->append(new Data(RET_FLOAT, (void *) (__PARAM)));
|
||||
#define P_ITEMINFO(__PARAM) __vec->append(new Data(RET_ITEMINFO, (void *) & (__PARAM)));
|
||||
|
||||
#define KILL_VECTOR() \
|
||||
CVector<Data *>::iterator end=__vec->end(); \
|
||||
for (CVector<Data *>::iterator i=__vec->begin(); i!=end; ++i) \
|
||||
for (size_t i = 0; i < __vec->length(); ++i) \
|
||||
{ \
|
||||
delete (*i); \
|
||||
delete __vec->at(i); \
|
||||
} \
|
||||
delete __vec; \
|
||||
ParamStack.pop();
|
||||
@ -83,12 +82,11 @@ extern bool gDoForwards;
|
||||
int thisresult=HAM_UNSET; \
|
||||
if (DoForwards) \
|
||||
{ \
|
||||
CVector<Forward*>::iterator end=hook->pre.end(); \
|
||||
for (CVector<Forward*>::iterator i=hook->pre.begin(); i!=end; i++) \
|
||||
for (size_t i = 0; i < hook->pre.length(); ++i) \
|
||||
{ \
|
||||
if ((*i)->state == FSTATE_OK) \
|
||||
if (hook->pre.at(i)->state == FSTATE_OK) \
|
||||
{ \
|
||||
thisresult=MF_ExecuteForward((*i)->id,iThis
|
||||
thisresult = MF_ExecuteForward(hook->pre.at(i)->id, iThis
|
||||
|
||||
#define PRE_END() \
|
||||
); \
|
||||
@ -106,12 +104,11 @@ extern bool gDoForwards;
|
||||
} \
|
||||
if (DoForwards) \
|
||||
{ \
|
||||
CVector<Forward*>::iterator end=hook->post.end(); \
|
||||
for (CVector<Forward*>::iterator i=hook->post.begin(); i!=end; i++) \
|
||||
for (size_t i = 0; i < hook->post.length(); ++i) \
|
||||
{ \
|
||||
if ((*i)->state == FSTATE_OK) \
|
||||
if (hook->post.at(i)->state == FSTATE_OK) \
|
||||
{ \
|
||||
MF_ExecuteForward((*i)->id,iThis
|
||||
MF_ExecuteForward(hook->post.at(i)->id, iThis
|
||||
|
||||
#define POST_END() \
|
||||
); \
|
||||
@ -130,7 +127,7 @@ extern bool gDoForwards;
|
||||
#define CHECK_RETURN_STR() \
|
||||
if (thisresult < HAM_OVERRIDE) \
|
||||
{ \
|
||||
return origret.c_str(); \
|
||||
return origret.chars(); \
|
||||
}
|
||||
#define CHECK_RETURN_VEC() \
|
||||
if (thisresult < HAM_OVERRIDE) \
|
||||
@ -434,7 +431,7 @@ int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i
|
||||
int origret=0;
|
||||
PUSH_INT()
|
||||
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -443,16 +440,16 @@ int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i
|
||||
P_INT(i2)
|
||||
|
||||
PRE_START()
|
||||
,i1, a.c_str(), i2
|
||||
,i1, a.chars(), i2
|
||||
PRE_END()
|
||||
#if defined(_WIN32)
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, int, const char *, int)>(hook->func)(pthis, 0, i1, a.c_str(), i2);
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, int, const char *, int)>(hook->func)(pthis, 0, i1, a.chars(), i2);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret=reinterpret_cast<int (*)(void*, int, const char *, int)>(hook->func)(pthis, i1, a.c_str(), i2);
|
||||
origret=reinterpret_cast<int (*)(void*, int, const char *, int)>(hook->func)(pthis, i1, a.chars(), i2);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
,i1, a.c_str(), i2
|
||||
,i1, a.chars(), i2
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -467,7 +464,7 @@ int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, i
|
||||
int origret = 0;
|
||||
PUSH_INT()
|
||||
|
||||
String a = sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -477,16 +474,16 @@ int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, i
|
||||
P_INT(i3)
|
||||
|
||||
PRE_START()
|
||||
, i1, a.c_str(), i2, i3
|
||||
, i1, a.chars(), i2, i3
|
||||
PRE_END()
|
||||
#if defined(_WIN32)
|
||||
origret = reinterpret_cast<int(__fastcall*)(void*, int, int, const char *, int, int)>(hook->func)(pthis, 0, i1, a.c_str(), i2, i3);
|
||||
origret = reinterpret_cast<int(__fastcall*)(void*, int, int, const char *, int, int)>(hook->func)(pthis, 0, i1, a.chars(), i2, i3);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret = reinterpret_cast<int(*)(void*, int, const char *, int, int)>(hook->func)(pthis, i1, a.c_str(), i2, i3);
|
||||
origret = reinterpret_cast<int(*)(void*, int, const char *, int, int)>(hook->func)(pthis, i1, a.chars(), i2, i3);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, i1, a.c_str(), i2, i3
|
||||
, i1, a.chars(), i2, i3
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -815,8 +812,8 @@ void Hook_Void_Float_Vector_Trace_Int(Hook *hook, void *pthis, float f1, Vector
|
||||
|
||||
const char *Hook_Str_Void(Hook *hook, void *pthis)
|
||||
{
|
||||
String ret;
|
||||
String origret;
|
||||
ke::AString ret;
|
||||
ke::AString origret;
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -825,9 +822,9 @@ const char *Hook_Str_Void(Hook *hook, void *pthis)
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret.assign(reinterpret_cast<const char *(__fastcall*)(void*, int)>(hook->func)(pthis, 0));
|
||||
origret = reinterpret_cast<const char *(__fastcall*)(void*, int)>(hook->func)(pthis, 0);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret.assign(reinterpret_cast<const char *(*)(void*)>(hook->func)(pthis));
|
||||
origret = reinterpret_cast<const char *(*)(void*)>(hook->func)(pthis);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
@ -837,7 +834,7 @@ const char *Hook_Str_Void(Hook *hook, void *pthis)
|
||||
POP()
|
||||
CHECK_RETURN_STR();
|
||||
|
||||
return ret.c_str();
|
||||
return ret.chars();
|
||||
}
|
||||
|
||||
void *Hook_Cbase_Void(Hook *hook, void *pthis)
|
||||
@ -1402,7 +1399,7 @@ int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2)
|
||||
void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3)
|
||||
{
|
||||
PUSH_VOID()
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -1412,17 +1409,17 @@ void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, f
|
||||
P_FLOAT(f3)
|
||||
|
||||
PRE_START()
|
||||
,a.c_str(), f1, f2, f3
|
||||
,a.chars(), f1, f2, f3
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, float, float, float)>(hook->func)(pthis, 0, a.c_str(), f1, f2, f3);
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, float, float, float)>(hook->func)(pthis, 0, a.chars(), f1, f2, f3);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<int (*)(void*, const char *, float, float, float)>(hook->func)(pthis, a.c_str(), f1, f2, f3);
|
||||
reinterpret_cast<int (*)(void*, const char *, float, float, float)>(hook->func)(pthis, a.chars(), f1, f2, f3);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
,a.c_str(), f1, f2, f3
|
||||
,a.chars(), f1, f2, f3
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -1433,7 +1430,7 @@ void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const ch
|
||||
{
|
||||
PUSH_VOID()
|
||||
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
int iEnt=PrivateToIndex(cb);
|
||||
|
||||
MAKE_VECTOR()
|
||||
@ -1446,17 +1443,17 @@ void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const ch
|
||||
P_CBASE(cb, iEnt)
|
||||
|
||||
PRE_START()
|
||||
,a.c_str(), f1, f2, f3, i1, iEnt
|
||||
,a.chars(), f1, f2, f3, i1, iEnt
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, float, float, float, int, void *)>(hook->func)(pthis, 0, a.c_str(), f1, f2, f3, i1, cb);
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, float, float, float, int, void *)>(hook->func)(pthis, 0, a.chars(), f1, f2, f3, i1, cb);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<int (*)(void*, const char *, float, float, float, int, void *)>(hook->func)(pthis, a.c_str(), f1, f2, f3, i1, cb);
|
||||
reinterpret_cast<int (*)(void*, const char *, float, float, float, int, void *)>(hook->func)(pthis, a.chars(), f1, f2, f3, i1, cb);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
,a.c_str(), f1, f2, f3, i1, iEnt
|
||||
,a.chars(), f1, f2, f3, i1, iEnt
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -1644,23 +1641,23 @@ int Hook_Int_Str(Hook *hook, void *pthis, const char *sz1)
|
||||
int origret=0;
|
||||
|
||||
PUSH_INT()
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
P_STR(a)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *)>(hook->func)(pthis, 0, a.c_str());
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *)>(hook->func)(pthis, 0, a.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret=reinterpret_cast<int (*)(void*, const char *)>(hook->func)(pthis, a.c_str());
|
||||
origret=reinterpret_cast<int (*)(void*, const char *)>(hook->func)(pthis, a.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -1758,7 +1755,7 @@ void Hook_Void_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2)
|
||||
void Hook_Void_Str_Bool(Hook *hook, void *pthis, const char *sz1, bool b2)
|
||||
{
|
||||
PUSH_VOID()
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -1766,17 +1763,17 @@ void Hook_Void_Str_Bool(Hook *hook, void *pthis, const char *sz1, bool b2)
|
||||
P_BOOL(b2)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), b2
|
||||
, a.chars(), b2
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *, bool)>(hook->func)(pthis, 0, a.c_str(), b2);
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *, bool)>(hook->func)(pthis, 0, a.chars(), b2);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<void (*)(void*, const char *, bool)>(hook->func)(pthis, a.c_str(), b2);
|
||||
reinterpret_cast<void (*)(void*, const char *, bool)>(hook->func)(pthis, a.chars(), b2);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), b2
|
||||
, a.chars(), b2
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -1858,7 +1855,8 @@ int Hook_Int_Int_Int_Float_Int(Hook *hook, void *pthis, int i1, int i2, float f1
|
||||
void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2)
|
||||
{
|
||||
PUSH_VOID()
|
||||
String a=sz1;
|
||||
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -1866,17 +1864,17 @@ void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2)
|
||||
P_INT(i2)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), i2
|
||||
, a.chars(), i2
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *, int)>(hook->func)(pthis, 0, a.c_str(), i2);
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *, int)>(hook->func)(pthis, 0, a.chars(), i2);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<void (*)(void*, const char *, int)>(hook->func)(pthis, a.c_str(), i2);
|
||||
reinterpret_cast<void (*)(void*, const char *, int)>(hook->func)(pthis, a.chars(), i2);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), i2
|
||||
, a.chars(), i2
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -1914,24 +1912,24 @@ void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1)
|
||||
void Hook_Void_Str(Hook *hook, void *pthis, const char *sz1)
|
||||
{
|
||||
PUSH_VOID()
|
||||
String a=sz1;
|
||||
ke::AString a(sz1);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
P_STR(a)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *)>(hook->func)(pthis, 0, a.c_str());
|
||||
reinterpret_cast<void (__fastcall*)(void*, int, const char *)>(hook->func)(pthis, 0, a.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<void (*)(void*, const char *)>(hook->func)(pthis, a.c_str());
|
||||
reinterpret_cast<void (*)(void*, const char *)>(hook->func)(pthis, a.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -1970,8 +1968,8 @@ int Hook_Int_Str_Vector_Str(Hook *hook, void *pthis, const char *sz1, Vector v2,
|
||||
|
||||
PUSH_INT()
|
||||
|
||||
String a=sz1;
|
||||
String b=sz2;
|
||||
ke::AString a(sz1);
|
||||
ke::AString b(sz2);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -1980,17 +1978,17 @@ int Hook_Int_Str_Vector_Str(Hook *hook, void *pthis, const char *sz1, Vector v2,
|
||||
P_STR(b)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), MF_PrepareCellArrayA(reinterpret_cast<cell *>(&v2), 3, false), b.c_str()
|
||||
, a.chars(), MF_PrepareCellArrayA(reinterpret_cast<cell *>(&v2), 3, false), b.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *, Vector, const char *)>(hook->func)(pthis, 0, a.c_str(), v2, b.c_str());
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *, Vector, const char *)>(hook->func)(pthis, 0, a.chars(), v2, b.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret=reinterpret_cast<int (*)(void*, const char *, Vector, const char *)>(hook->func)(pthis, a.c_str(), v2, b.c_str());
|
||||
origret=reinterpret_cast<int (*)(void*, const char *, Vector, const char *)>(hook->func)(pthis, a.chars(), v2, b.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), MF_PrepareCellArrayA(reinterpret_cast<cell *>(&v2), 3, false), b.c_str()
|
||||
, a.chars(), MF_PrepareCellArrayA(reinterpret_cast<cell *>(&v2), 3, false), b.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -2007,8 +2005,8 @@ int Hook_Int_Str_Str(Hook *hook, void *pthis, const char *sz1, const char *sz2)
|
||||
|
||||
PUSH_INT()
|
||||
|
||||
String a=sz1;
|
||||
String b=sz2;
|
||||
ke::AString a(sz1);
|
||||
ke::AString b(sz2);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -2016,17 +2014,17 @@ int Hook_Int_Str_Str(Hook *hook, void *pthis, const char *sz1, const char *sz2)
|
||||
P_STR(b)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), b.c_str()
|
||||
, a.chars(), b.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *, const char *)>(hook->func)(pthis, 0, a.c_str(), b.c_str());
|
||||
origret=reinterpret_cast<int (__fastcall*)(void*, int, const char *, const char *)>(hook->func)(pthis, 0, a.chars(), b.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret=reinterpret_cast<int (*)(void*, const char *, const char *)>(hook->func)(pthis, a.c_str(), b.c_str());
|
||||
origret=reinterpret_cast<int (*)(void*, const char *, const char *)>(hook->func)(pthis, a.chars(), b.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), b.c_str()
|
||||
, a.chars(), b.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -2066,8 +2064,8 @@ void Hook_Void_Str_Str_Int(Hook *hook, void *pthis, const char *sz1, const char
|
||||
{
|
||||
PUSH_VOID()
|
||||
|
||||
String a=sz1;
|
||||
String b=sz2;
|
||||
ke::AString a(sz1);
|
||||
ke::AString b(sz2);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -2076,17 +2074,17 @@ void Hook_Void_Str_Str_Int(Hook *hook, void *pthis, const char *sz1, const char
|
||||
P_INT(i3)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str(), b.c_str(), i3
|
||||
, a.chars(), b.chars(), i3
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, const char *, int)>(hook->func)(pthis, 0, a.c_str(), b.c_str(), i3);
|
||||
reinterpret_cast<int (__fastcall*)(void*, int, const char *, const char *, int)>(hook->func)(pthis, 0, a.chars(), b.chars(), i3);
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
reinterpret_cast<int (*)(void*, const char *, const char *, int)>(hook->func)(pthis, a.c_str(), b.c_str(), i3);
|
||||
reinterpret_cast<int (*)(void*, const char *, const char *, int)>(hook->func)(pthis, a.chars(), b.chars(), i3);
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str(), b.c_str(), i3
|
||||
, a.chars(), b.chars(), i3
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
@ -2746,9 +2744,9 @@ void Hook_Vector_Vector_Vector_Vector(Hook *hook, Vector *out, void *pthis, Vect
|
||||
|
||||
const char *Hook_Str_Str(Hook *hook, void *pthis, const char* str)
|
||||
{
|
||||
String ret;
|
||||
String origret;
|
||||
String a = str;
|
||||
ke::AString ret;
|
||||
ke::AString origret;
|
||||
ke::AString a(str);
|
||||
|
||||
MAKE_VECTOR()
|
||||
|
||||
@ -2757,24 +2755,24 @@ const char *Hook_Str_Str(Hook *hook, void *pthis, const char* str)
|
||||
P_STR(a)
|
||||
|
||||
PRE_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
PRE_END()
|
||||
|
||||
#if defined(_WIN32)
|
||||
origret.assign(reinterpret_cast<const char *(__fastcall*)(void*, int, const char*)>(hook->func)(pthis, 0, a.c_str() ));
|
||||
origret = reinterpret_cast<const char *(__fastcall*)(void*, int, const char*)>(hook->func)(pthis, 0, a.chars());
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
origret.assign(reinterpret_cast<const char *(*)(void*, const char*)>(hook->func)(pthis, a.c_str()));
|
||||
origret = reinterpret_cast<const char *(*)(void*, const char*)>(hook->func)(pthis, a.chars());
|
||||
#endif
|
||||
|
||||
POST_START()
|
||||
, a.c_str()
|
||||
, a.chars()
|
||||
POST_END()
|
||||
|
||||
KILL_VECTOR()
|
||||
POP()
|
||||
CHECK_RETURN_STR();
|
||||
|
||||
return ret.c_str();
|
||||
return ret.chars();
|
||||
}
|
||||
|
||||
void Hook_Void_Short(Hook *hook, void *pthis, short i1)
|
||||
|
@ -19,9 +19,6 @@
|
||||
#include <extdll.h>
|
||||
#include "amxxmodule.h"
|
||||
|
||||
|
||||
#include "CVector.h"
|
||||
|
||||
#include "hook.h"
|
||||
#include "forward.h"
|
||||
#include "hook_callbacks.h"
|
||||
@ -31,12 +28,13 @@
|
||||
#include "hooklist.h"
|
||||
#include "ham_utils.h"
|
||||
#include "hook_specialbot.h"
|
||||
#include <am-vector.h>
|
||||
|
||||
OffsetManager Offsets;
|
||||
|
||||
bool gDoForwards=true;
|
||||
|
||||
CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
ke::Vector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
CHamSpecialBotHandler SpecialbotHandler;
|
||||
|
||||
#define V(__KEYNAME, __STUFF__) 0, 0, __KEYNAME, RT_##__STUFF__, RB_##__STUFF__, PC_##__STUFF__, reinterpret_cast<void *>(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__
|
||||
@ -596,22 +594,19 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
|
||||
|
||||
// Check the list of this function's hooks, see if the function we have is a hook
|
||||
|
||||
CVector<Hook *>::iterator end=hooks[func].end();
|
||||
for (CVector<Hook *>::iterator i=hooks[func].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[func].length(); ++i)
|
||||
{
|
||||
if ((*i)->tramp == vfunction)
|
||||
if (hooks[func].at(i)->tramp == vfunction)
|
||||
{
|
||||
// Yes, this function is hooked
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
(*i)->post.push_back(pfwd);
|
||||
hooks[func].at(i)->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->pre.push_back(pfwd);
|
||||
hooks[func].at(i)->pre.append(pfwd);
|
||||
}
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
}
|
||||
@ -619,16 +614,16 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
|
||||
|
||||
// If we got here, the function is not hooked
|
||||
Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);
|
||||
hooks[func].push_back(hook);
|
||||
hooks[func].append(hook);
|
||||
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
hook->post.push_back(pfwd);
|
||||
hook->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
hook->pre.push_back(pfwd);
|
||||
hook->pre.append(pfwd);
|
||||
}
|
||||
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
@ -687,22 +682,19 @@ static cell AMX_NATIVE_CALL RegisterHamFromEntity(AMX *amx, cell *params)
|
||||
|
||||
// Check the list of this function's hooks, see if the function we have is a hook
|
||||
|
||||
CVector<Hook *>::iterator end=hooks[func].end();
|
||||
for (CVector<Hook *>::iterator i=hooks[func].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[func].length(); ++i)
|
||||
{
|
||||
if ((*i)->tramp == vfunction)
|
||||
if (hooks[func].at(i)->tramp == vfunction)
|
||||
{
|
||||
// Yes, this function is hooked
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
(*i)->post.push_back(pfwd);
|
||||
hooks[func].at(i)->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->pre.push_back(pfwd);
|
||||
hooks[func].at(i)->pre.append(pfwd);
|
||||
}
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
}
|
||||
@ -716,16 +708,16 @@ static cell AMX_NATIVE_CALL RegisterHamFromEntity(AMX *amx, cell *params)
|
||||
|
||||
// If we got here, the function is not hooked
|
||||
Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);
|
||||
hooks[func].push_back(hook);
|
||||
hooks[func].append(hook);
|
||||
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
hook->post.push_back(pfwd);
|
||||
hook->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
hook->pre.push_back(pfwd);
|
||||
hook->pre.append(pfwd);
|
||||
}
|
||||
|
||||
return reinterpret_cast<cell>(pfwd);
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "hooklist.h"
|
||||
#include "hook.h"
|
||||
|
||||
extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern ke::Vector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern hook_t hooklist[];
|
||||
|
||||
|
||||
@ -61,12 +61,11 @@ void CHamSpecialBotHandler::CheckClientKeyValue(int &clientIndex, char *infobuff
|
||||
if(m_RHP_list.empty())
|
||||
return;
|
||||
|
||||
CVector<CRegisterHamParams*>::iterator i = m_RHP_list.begin();
|
||||
CVector<CRegisterHamParams*>::iterator end = m_RHP_list.end();
|
||||
for(; i!=end; i++)
|
||||
for (size_t i = 0; i < m_RHP_list.length(); ++i)
|
||||
{
|
||||
RegisterChecked((*i)->amx, (*i)->func, (*i)->function, (*i)->post, (*i)->fwd);
|
||||
delete *i;
|
||||
CRegisterHamParams *item = m_RHP_list.at(i);
|
||||
RegisterChecked(item->amx, item->func, item->function, item->post, item->fwd);
|
||||
delete item;
|
||||
}
|
||||
|
||||
m_RHP_list.clear();
|
||||
@ -76,7 +75,7 @@ void CHamSpecialBotHandler::RegisterHamSpecialBot(AMX *amx, int &func, const cha
|
||||
{
|
||||
if(m_specialbot_vtable == NULL)
|
||||
{
|
||||
m_RHP_list.push_back( new CRegisterHamParams(amx, func, function, post, fwd) );
|
||||
m_RHP_list.append( new CRegisterHamParams(amx, func, function, post, fwd) );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -90,22 +89,19 @@ void CHamSpecialBotHandler::RegisterChecked(AMX *amx, int &func, const char *fun
|
||||
|
||||
void *vfunction=(void *)ivtable[hooklist[func].vtid];
|
||||
|
||||
CVector<Hook *>::iterator end=hooks[func].end();
|
||||
for (CVector<Hook *>::iterator i=hooks[func].begin();
|
||||
i!=end;
|
||||
++i)
|
||||
for (size_t i = 0; i < hooks[func].length(); ++i)
|
||||
{
|
||||
if ((*i)->tramp == vfunction)
|
||||
if (hooks[func].at(i)->tramp == vfunction)
|
||||
{
|
||||
// Yes, this function is hooked
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
Forward *pfwd = new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
(*i)->post.push_back(pfwd);
|
||||
hooks[func].at(i)->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*i)->pre.push_back(pfwd);
|
||||
hooks[func].at(i)->pre.append(pfwd);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -115,15 +111,15 @@ void CHamSpecialBotHandler::RegisterChecked(AMX *amx, int &func, const char *fun
|
||||
|
||||
// If we got here, the function is not hooked
|
||||
Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);
|
||||
hooks[func].push_back(hook);
|
||||
hooks[func].append(hook);
|
||||
|
||||
Forward *pfwd=new Forward(fwd);
|
||||
if (post)
|
||||
{
|
||||
hook->post.push_back(pfwd);
|
||||
hook->post.append(pfwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
hook->pre.push_back(pfwd);
|
||||
hook->pre.append(pfwd);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
#define HOOK_SPECIALBOT_H
|
||||
|
||||
#include "ham_utils.h"
|
||||
#include "CVector.h"
|
||||
#include <am-vector.h>
|
||||
|
||||
class CRegisterHamParams
|
||||
{
|
||||
@ -42,7 +42,7 @@ public:
|
||||
private:
|
||||
void RegisterChecked(AMX *amx, int &func, const char *function, int &post, int &fwd);
|
||||
|
||||
CVector<CRegisterHamParams*> m_RHP_list;
|
||||
ke::Vector<CRegisterHamParams*> m_RHP_list;
|
||||
void **m_specialbot_vtable;
|
||||
};
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;HAMSANDWICH_EXPORTS; HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -77,7 +77,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\;..\sdk;..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\;..\..\..\public;..\..\..\public\sdk; ..\..\..\public\amtl;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;HAMSANDWICH_EXPORTS; HAVE_STDINT_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
@ -101,7 +101,7 @@
|
||||
<ClCompile Include="..\hook_create.cpp" />
|
||||
<ClCompile Include="..\hook_native.cpp" />
|
||||
<ClCompile Include="..\hook_specialbot.cpp" />
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp" />
|
||||
<ClCompile Include="..\config_parser.cpp" />
|
||||
<ClCompile Include="..\DataHandler.cpp" />
|
||||
<ClCompile Include="..\pdata.cpp" />
|
||||
@ -118,11 +118,8 @@
|
||||
<ClInclude Include="..\hook_specialbot.h" />
|
||||
<ClInclude Include="..\typetocell.h" />
|
||||
<ClInclude Include="..\Trampolines.h" />
|
||||
<ClInclude Include="..\sdk\moduleconfig.h" />
|
||||
<ClInclude Include="..\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\sdk\CString.h" />
|
||||
<ClInclude Include="..\sdk\CVector.h" />
|
||||
<ClInclude Include="..\sdk\sh_stack.h" />
|
||||
<ClInclude Include="..\moduleconfig.h" />
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
|
||||
<ClInclude Include="..\DataHandler.h" />
|
||||
<ClInclude Include="..\ham_const.h" />
|
||||
<ClInclude Include="..\ham_utils.h" />
|
||||
|
@ -13,9 +13,6 @@
|
||||
<Filter Include="Module SDK\SDK Base">
|
||||
<UniqueIdentifier>{4fb419c2-3177-4389-9713-a7b032b57c1c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Module SDK\AMXX STL">
|
||||
<UniqueIdentifier>{a97b8a80-4ea7-4972-ab41-235e19831dff}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Config File">
|
||||
<UniqueIdentifier>{f626de6a-9bea-468b-97e9-4f5d62307d78}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@ -47,9 +44,6 @@
|
||||
<ClCompile Include="..\hook_native.cpp">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\config_parser.cpp">
|
||||
<Filter>Config File</Filter>
|
||||
</ClCompile>
|
||||
@ -68,6 +62,9 @@
|
||||
<ClCompile Include="..\hook_specialbot.cpp">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\public\sdk\amxxmodule.cpp">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\call_funcs.h">
|
||||
@ -94,21 +91,6 @@
|
||||
<ClInclude Include="..\Trampolines.h">
|
||||
<Filter>Hooks\Trampolines</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\CString.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\CVector.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\sdk\sh_stack.h">
|
||||
<Filter>Module SDK\AMXX STL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\DataHandler.h">
|
||||
<Filter>Data Handler</Filter>
|
||||
</ClInclude>
|
||||
@ -127,6 +109,12 @@
|
||||
<ClInclude Include="..\hook_specialbot.h">
|
||||
<Filter>Hooks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h">
|
||||
<Filter>Module SDK\SDK Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\moduleconfig.h">
|
||||
<Filter>Module SDK</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\plugins\include\ham_const.inc">
|
||||
|
@ -1,391 +0,0 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
#ifndef _INCLUDE_CSTRING_H
|
||||
#define _INCLUDE_CSTRING_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//by David "BAILOPAN" Anderson
|
||||
class String
|
||||
{
|
||||
public:
|
||||
String()
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
//assign("");
|
||||
}
|
||||
|
||||
~String()
|
||||
{
|
||||
if (v)
|
||||
delete [] v;
|
||||
}
|
||||
|
||||
String(const char *src)
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
assign(src);
|
||||
}
|
||||
|
||||
const char * _fread(FILE *fp)
|
||||
{
|
||||
Grow(512, false);
|
||||
char *ret = fgets(v, 511, fp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
String(const String &src)
|
||||
{
|
||||
v = NULL;
|
||||
a_size = 0;
|
||||
assign(src.c_str());
|
||||
}
|
||||
|
||||
const char *c_str() { return v?v:""; }
|
||||
|
||||
const char *c_str() const { return v?v:""; }
|
||||
|
||||
void append(const char *t)
|
||||
{
|
||||
Grow(size() + strlen(t) + 1);
|
||||
strcat(v, t);
|
||||
}
|
||||
|
||||
void append(const char c)
|
||||
{
|
||||
size_t len = size();
|
||||
Grow(len + 2);
|
||||
v[len] = c;
|
||||
v[len + 1] = '\0';
|
||||
}
|
||||
|
||||
void append(String &d)
|
||||
{
|
||||
append(d.c_str());
|
||||
}
|
||||
|
||||
void assign(const String &src)
|
||||
{
|
||||
assign(src.c_str());
|
||||
}
|
||||
|
||||
void assign(const char *d)
|
||||
{
|
||||
if (!d)
|
||||
{
|
||||
clear();
|
||||
} else {
|
||||
size_t len = strlen(d);
|
||||
Grow(len + 1, false);
|
||||
memcpy(v, d, len);
|
||||
v[len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
if (v)
|
||||
v[0] = '\0';
|
||||
}
|
||||
|
||||
int compare (const char *d) const
|
||||
{
|
||||
if (!v)
|
||||
return strcmp("", d);
|
||||
else
|
||||
return strcmp(v, d);
|
||||
}
|
||||
|
||||
//Added this for amxx inclusion
|
||||
bool empty() const
|
||||
{
|
||||
if (!v)
|
||||
return true;
|
||||
|
||||
if (v[0] == '\0')
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t size() const
|
||||
{
|
||||
if (v)
|
||||
return strlen(v);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int find(const char c, int index = 0)
|
||||
{
|
||||
int len = static_cast<int>(size());
|
||||
if (len < 1)
|
||||
return npos;
|
||||
if (index >= len || index < 0)
|
||||
return npos;
|
||||
int i = 0;
|
||||
for (i=index; i<len; i++)
|
||||
{
|
||||
if (v[i] == c)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return npos;
|
||||
}
|
||||
|
||||
bool is_space(int c)
|
||||
{
|
||||
if (c == '\f' || c == '\n' ||
|
||||
c == '\t' || c == '\r' ||
|
||||
c == '\v' || c == ' ')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void reparse_newlines()
|
||||
{
|
||||
size_t len = size();
|
||||
int offs = 0;
|
||||
char c;
|
||||
if (!len)
|
||||
return;
|
||||
for (size_t i=0; i<len; i++)
|
||||
{
|
||||
c = v[i];
|
||||
if (c == '^' && (i != len-1))
|
||||
{
|
||||
c = v[++i];
|
||||
if (c == 'n')
|
||||
c = '\n';
|
||||
else if (c == 't')
|
||||
c = '\t';
|
||||
offs++;
|
||||
}
|
||||
v[i-offs] = c;
|
||||
}
|
||||
v[len-offs] = '\0';
|
||||
}
|
||||
|
||||
void trim()
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
size_t len = strlen(v);
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
if (is_space(v[i]))
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char c0 = v[0];
|
||||
|
||||
if (is_space(c0))
|
||||
{
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (!is_space(v[i]) || (is_space(v[i]) && ((unsigned char)i==len-1)))
|
||||
{
|
||||
erase(0, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
len = strlen(v);
|
||||
|
||||
if (len < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_space(v[len-1]))
|
||||
{
|
||||
for (i=len-1; i<len; i--)
|
||||
{
|
||||
if (!is_space(v[i])
|
||||
|| (is_space(v[i]) && i==0))
|
||||
{
|
||||
erase(i+1, j);
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
if (len == 1)
|
||||
{
|
||||
if (is_space(v[0]))
|
||||
{
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void erase(unsigned int start, int num = npos)
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
unsigned int i = 0;
|
||||
size_t len = size();
|
||||
//check for bounds
|
||||
if (num == npos || start+num > len-start)
|
||||
num = len - start;
|
||||
//do the erasing
|
||||
bool copyflag = false;
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (i>=start && i<start+num)
|
||||
{
|
||||
if (i+num < len)
|
||||
{
|
||||
v[i] = v[i+num];
|
||||
} else {
|
||||
v[i] = 0;
|
||||
}
|
||||
copyflag = true;
|
||||
} else if (copyflag) {
|
||||
if (i+num < len)
|
||||
{
|
||||
v[i] = v[i+num];
|
||||
} else {
|
||||
v[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
len -= num;
|
||||
v[len] = 0;
|
||||
}
|
||||
|
||||
String substr(unsigned int index, int num = npos)
|
||||
{
|
||||
if (!v)
|
||||
{
|
||||
String b("");
|
||||
return b;
|
||||
}
|
||||
|
||||
String ns;
|
||||
|
||||
size_t len = size();
|
||||
|
||||
if (index >= len || !v)
|
||||
return ns;
|
||||
|
||||
if (num == npos)
|
||||
{
|
||||
num = len - index;
|
||||
} else if (index+num >= len) {
|
||||
num = len - index;
|
||||
}
|
||||
|
||||
unsigned int i = 0;
|
||||
unsigned int nslen = num + 2;
|
||||
|
||||
ns.Grow(nslen);
|
||||
|
||||
for (i=index; i<index+num; i++)
|
||||
ns.append(v[i]);
|
||||
|
||||
return ns;
|
||||
}
|
||||
|
||||
void toLower()
|
||||
{
|
||||
if (!v)
|
||||
return;
|
||||
unsigned int i = 0;
|
||||
size_t len = strlen(v);
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (v[i] >= 65 && v[i] <= 90)
|
||||
v[i] &= ~(1<<5);
|
||||
}
|
||||
}
|
||||
|
||||
String & operator = (const String &src)
|
||||
{
|
||||
assign(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
String & operator = (const char *src)
|
||||
{
|
||||
assign(src);
|
||||
return *this;
|
||||
|
||||
}
|
||||
|
||||
char operator [] (unsigned int index)
|
||||
{
|
||||
if (index > size() || !v)
|
||||
{
|
||||
return -1;
|
||||
} else {
|
||||
return v[index];
|
||||
}
|
||||
}
|
||||
|
||||
int at(int a)
|
||||
{
|
||||
if (a < 0 || a >= (int)size() || !v)
|
||||
return -1;
|
||||
|
||||
return v[a];
|
||||
}
|
||||
|
||||
bool at(int at, char c)
|
||||
{
|
||||
if (at < 0 || at >= (int)size() || !v)
|
||||
return false;
|
||||
|
||||
v[at] = c;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
void Grow(unsigned int d, bool copy=true)
|
||||
{
|
||||
if (d <= a_size)
|
||||
return;
|
||||
char *n = new char[d + 1];
|
||||
if (copy && v)
|
||||
strcpy(n, v);
|
||||
if (v)
|
||||
delete [] v;
|
||||
else
|
||||
strcpy(n, "");
|
||||
v = n;
|
||||
a_size = d + 1;
|
||||
}
|
||||
|
||||
char *v;
|
||||
unsigned int a_size;
|
||||
public:
|
||||
static const int npos = -1;
|
||||
};
|
||||
|
||||
#endif //_INCLUDE_CSTRING_H
|
@ -1,480 +0,0 @@
|
||||
// vim: set ts=4 sw=4 tw=99 noet:
|
||||
//
|
||||
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
||||
// Copyright (C) The AMX Mod X Development Team.
|
||||
//
|
||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// https://alliedmods.net/amxmodx-license
|
||||
|
||||
#ifndef __CVECTOR_H__
|
||||
#define __CVECTOR_H__
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
// Vector
|
||||
template <class T> class CVector
|
||||
{
|
||||
bool Grow(size_t amount)
|
||||
{
|
||||
// automatic grow
|
||||
size_t newSize = m_Size * 2;
|
||||
|
||||
if (newSize == 0)
|
||||
{
|
||||
newSize = 8;
|
||||
}
|
||||
|
||||
while (m_CurrentUsedSize + amount > newSize)
|
||||
{
|
||||
newSize *= 2;
|
||||
}
|
||||
T *newData = new T[newSize];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
for (size_t i=0; i<m_CurrentUsedSize; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
m_Data = newData;
|
||||
m_Size = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GrowIfNeeded(size_t amount)
|
||||
{
|
||||
if (m_CurrentUsedSize + amount >= m_Size)
|
||||
{
|
||||
return Grow(amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChangeSize(size_t size)
|
||||
{
|
||||
// change size
|
||||
if (size == m_Size)
|
||||
return true;
|
||||
|
||||
if (!size)
|
||||
{
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
m_Size = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T *newData = new T[size];
|
||||
if (!newData)
|
||||
return false;
|
||||
if (m_Data)
|
||||
{
|
||||
size_t end = (m_CurrentUsedSize < size) ? (m_CurrentUsedSize) : size;
|
||||
for (size_t i=0; i<end; i++)
|
||||
newData[i] = m_Data[i];
|
||||
delete [] m_Data;
|
||||
}
|
||||
m_Data = newData;
|
||||
m_Size = size;
|
||||
if (m_CurrentUsedSize > m_Size)
|
||||
m_CurrentUsedSize = m_Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void FreeMemIfPossible()
|
||||
{
|
||||
if (!m_Data)
|
||||
return;
|
||||
|
||||
if (!m_CurrentUsedSize)
|
||||
{
|
||||
ChangeSize(0);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t newSize = m_Size;
|
||||
while (m_CurrentUsedSize <= newSize / 2)
|
||||
newSize /= 2;
|
||||
|
||||
if (newSize != m_Size)
|
||||
ChangeSize(newSize);
|
||||
}
|
||||
protected:
|
||||
T *m_Data;
|
||||
size_t m_Size;
|
||||
size_t m_CurrentUsedSize;
|
||||
public:
|
||||
class iterator
|
||||
{
|
||||
protected:
|
||||
T *m_Ptr;
|
||||
public:
|
||||
// constructors / destructors
|
||||
iterator()
|
||||
{
|
||||
m_Ptr = NULL;
|
||||
}
|
||||
|
||||
iterator(T * ptr)
|
||||
{
|
||||
m_Ptr = ptr;
|
||||
}
|
||||
|
||||
// member functions
|
||||
T * base()
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
const T * base() const
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
// operators
|
||||
T & operator*()
|
||||
{
|
||||
return *m_Ptr;
|
||||
}
|
||||
|
||||
T * operator->()
|
||||
{
|
||||
return m_Ptr;
|
||||
}
|
||||
|
||||
iterator & operator++() // preincrement
|
||||
{
|
||||
++m_Ptr;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator++(int) // postincrement
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++m_Ptr;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator & operator--() // predecrement
|
||||
{
|
||||
--m_Ptr;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator--(int) // postdecrememnt
|
||||
{
|
||||
iterator tmp = *this;
|
||||
--m_Ptr;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(T * right) const
|
||||
{
|
||||
return (m_Ptr == right);
|
||||
}
|
||||
|
||||
bool operator==(const iterator & right) const
|
||||
{
|
||||
return (m_Ptr == right.m_Ptr);
|
||||
}
|
||||
|
||||
bool operator!=(T * right) const
|
||||
{
|
||||
return (m_Ptr != right);
|
||||
}
|
||||
|
||||
bool operator!=(const iterator & right) const
|
||||
{
|
||||
return (m_Ptr != right.m_Ptr);
|
||||
}
|
||||
|
||||
iterator & operator+=(size_t offset)
|
||||
{
|
||||
m_Ptr += offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator & operator-=(size_t offset)
|
||||
{
|
||||
m_Ptr -= offset;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator+(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr += offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator operator-(size_t offset) const
|
||||
{
|
||||
iterator tmp(*this);
|
||||
tmp.m_Ptr -= offset;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
T & operator[](size_t offset)
|
||||
{
|
||||
return (*(*this + offset));
|
||||
}
|
||||
|
||||
const T & operator[](size_t offset) const
|
||||
{
|
||||
return (*(*this + offset));
|
||||
}
|
||||
|
||||
bool operator<(const iterator & right) const
|
||||
{
|
||||
return m_Ptr < right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator>(const iterator & right) const
|
||||
{
|
||||
return m_Ptr > right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator<=(const iterator & right) const
|
||||
{
|
||||
return m_Ptr <= right.m_Ptr;
|
||||
}
|
||||
|
||||
bool operator>=(const iterator & right) const
|
||||
{
|
||||
return m_Ptr >= right.m_Ptr;
|
||||
}
|
||||
|
||||
size_t operator-(const iterator & right) const
|
||||
{
|
||||
return m_Ptr - right.m_Ptr;
|
||||
}
|
||||
};
|
||||
|
||||
// constructors / destructors
|
||||
CVector<T>()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
m_Data = NULL;
|
||||
}
|
||||
|
||||
CVector<T>(const CVector<T> & other)
|
||||
{
|
||||
// copy data
|
||||
m_Data = new T [other.m_CurrentUsedSize];
|
||||
m_Size = other.m_CurrentUsedSize;
|
||||
m_CurrentUsedSize = other.m_CurrentUsedSize;
|
||||
for (size_t i=0; i<other.m_CurrentUsedSize; i++)
|
||||
m_Data[i] = other.m_Data[i];
|
||||
}
|
||||
|
||||
~CVector<T>()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
// interface
|
||||
size_t size() const
|
||||
{
|
||||
return m_CurrentUsedSize;
|
||||
}
|
||||
|
||||
size_t capacity() const
|
||||
{
|
||||
return m_Size;
|
||||
}
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(m_Data);
|
||||
}
|
||||
|
||||
iterator end() const
|
||||
{
|
||||
return iterator(m_Data + m_CurrentUsedSize);
|
||||
}
|
||||
|
||||
iterator iterAt(size_t pos)
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
assert(0);
|
||||
return iterator(m_Data + pos);
|
||||
}
|
||||
|
||||
bool reserve(size_t newSize)
|
||||
{
|
||||
if (newSize > m_Size)
|
||||
return ChangeSize(newSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool push_back(const T & elem)
|
||||
{
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Data[m_CurrentUsedSize++] = elem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pop_back()
|
||||
{
|
||||
--m_CurrentUsedSize;
|
||||
if (m_CurrentUsedSize < 0)
|
||||
m_CurrentUsedSize = 0;
|
||||
|
||||
FreeMemIfPossible();
|
||||
}
|
||||
|
||||
bool resize(size_t newSize)
|
||||
{
|
||||
if (!ChangeSize(newSize))
|
||||
return false;
|
||||
m_CurrentUsedSize = newSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return (m_CurrentUsedSize == 0);
|
||||
}
|
||||
|
||||
T & at(size_t pos)
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[pos];
|
||||
}
|
||||
|
||||
const T & at(size_t pos) const
|
||||
{
|
||||
if (pos > m_CurrentUsedSize)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[pos];
|
||||
}
|
||||
|
||||
T & operator[](size_t pos)
|
||||
{
|
||||
return at(pos);
|
||||
}
|
||||
|
||||
const T & operator[](size_t pos) const
|
||||
{
|
||||
return at(pos);
|
||||
}
|
||||
|
||||
T & front()
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[0];
|
||||
}
|
||||
|
||||
const T & front() const
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[0];
|
||||
}
|
||||
|
||||
T & back()
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
const T & back() const
|
||||
{
|
||||
if (m_CurrentUsedSize < 1)
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
return m_Data[m_CurrentUsedSize - 1];
|
||||
}
|
||||
|
||||
iterator insert(iterator where, const T & value)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where > (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (!GrowIfNeeded(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
++m_CurrentUsedSize;
|
||||
|
||||
where = begin() + ofs;
|
||||
|
||||
// Move subsequent entries
|
||||
for (T *ptr = m_Data + m_CurrentUsedSize - 2; ptr >= where.base(); --ptr)
|
||||
*(ptr + 1) = *ptr;
|
||||
|
||||
*where.base() = value;
|
||||
|
||||
return where;
|
||||
}
|
||||
|
||||
iterator erase(iterator where)
|
||||
{
|
||||
// validate iter
|
||||
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||
return iterator(0);
|
||||
|
||||
size_t ofs = where - begin();
|
||||
|
||||
if (m_CurrentUsedSize > 1)
|
||||
{
|
||||
// move
|
||||
T *theend = m_Data + m_CurrentUsedSize;
|
||||
for (T *ptr = where.base() + 1; ptr < theend; ++ptr)
|
||||
*(ptr - 1) = *ptr;
|
||||
}
|
||||
|
||||
--m_CurrentUsedSize;
|
||||
|
||||
FreeMemIfPossible();
|
||||
|
||||
return begin() + ofs;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
m_Size = 0;
|
||||
m_CurrentUsedSize = 0;
|
||||
if (m_Data)
|
||||
{
|
||||
delete [] m_Data;
|
||||
m_Data = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // __CVECTOR_H__
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,219 +0,0 @@
|
||||
/* ======== SourceMM ========
|
||||
* Copyright (C) 2004-2005 Metamod:Source Development Team
|
||||
* No warranties of any kind
|
||||
*
|
||||
* License: zlib/libpng
|
||||
*
|
||||
* Author(s): Pavol "PM OnoTo" Marko
|
||||
* ============================
|
||||
*/
|
||||
|
||||
#ifndef __SH_STACK_H__
|
||||
#define __SH_STACK_H__
|
||||
|
||||
#define SH_STACK_DEFAULT_SIZE 4
|
||||
|
||||
//namespace SourceHook
|
||||
//{/
|
||||
// Vector
|
||||
template <class T> class CStack
|
||||
{
|
||||
T *m_Elements;
|
||||
size_t m_AllocatedSize;
|
||||
size_t m_UsedSize;
|
||||
public:
|
||||
friend class iterator;
|
||||
class iterator
|
||||
{
|
||||
CStack<T> *m_pParent;
|
||||
size_t m_Index;
|
||||
public:
|
||||
iterator(CStack<T> *pParent, size_t id) : m_pParent(pParent), m_Index(id)
|
||||
{
|
||||
}
|
||||
|
||||
iterator(CStack<T> *pParent) : m_pParent(pParent), m_Index(0)
|
||||
{
|
||||
}
|
||||
|
||||
iterator() : m_pParent(NULL), m_Index(0)
|
||||
{
|
||||
}
|
||||
|
||||
T &operator *()
|
||||
{
|
||||
return m_pParent->m_Elements[m_Index];
|
||||
}
|
||||
const T &operator *() const
|
||||
{
|
||||
return m_pParent->m_Elements[m_Index];
|
||||
}
|
||||
|
||||
T * operator->()
|
||||
{
|
||||
return m_pParent->m_Elements + m_Index;
|
||||
}
|
||||
|
||||
const T * operator->() const
|
||||
{
|
||||
return m_pParent->m_Elements + m_Index;
|
||||
}
|
||||
|
||||
iterator & operator++() // preincrement
|
||||
{
|
||||
++m_Index;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator++(int) // postincrement
|
||||
{
|
||||
iterator tmp = *this;
|
||||
++m_Index;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
iterator & operator--() // predecrement
|
||||
{
|
||||
--m_Index;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
iterator operator--(int) // postdecrememnt
|
||||
{
|
||||
iterator tmp = *this;
|
||||
--m_Index;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool operator==(const iterator & right) const
|
||||
{
|
||||
return (m_pParent == right.m_pParent && m_Index == right.m_Index);
|
||||
}
|
||||
|
||||
bool operator!=(const iterator & right) const
|
||||
{
|
||||
return !(*this == right);
|
||||
}
|
||||
};
|
||||
CStack() : m_Elements(new T[SH_STACK_DEFAULT_SIZE]),
|
||||
m_AllocatedSize(SH_STACK_DEFAULT_SIZE),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
}
|
||||
CStack(size_t size) : m_Elements(new T[size]),
|
||||
m_AllocatedSize(size),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
CStack(const CStack &other) : m_Elements(NULL),
|
||||
m_AllocatedSize(0),
|
||||
m_UsedSize(0)
|
||||
{
|
||||
reserve(other.m_AllocatedSize);
|
||||
m_UsedSize = other.m_UsedSize;
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
m_Elements[i] = other.m_Elements[i];
|
||||
}
|
||||
|
||||
~CStack()
|
||||
{
|
||||
if (m_Elements)
|
||||
delete [] m_Elements;
|
||||
}
|
||||
|
||||
void operator=(const CStack &other)
|
||||
{
|
||||
if (m_AllocatedSize < other.m_AllocatedSize)
|
||||
{
|
||||
if (m_Elements)
|
||||
delete [] m_Elements;
|
||||
m_Elements = new T[other.m_AllocatedSize];
|
||||
m_AllocatedSize = other.m_AllocatedSize;
|
||||
}
|
||||
m_UsedSize = other.m_UsedSize;
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
m_Elements[i] = other.m_Elements[i];
|
||||
}
|
||||
|
||||
bool push(const T &val)
|
||||
{
|
||||
if (m_UsedSize + 1 == m_AllocatedSize)
|
||||
{
|
||||
// zOHNOES! REALLOCATE!
|
||||
m_AllocatedSize *= 2;
|
||||
T *newElements = new T[m_AllocatedSize];
|
||||
if (!newElements)
|
||||
{
|
||||
m_AllocatedSize /= 2;
|
||||
return false;
|
||||
}
|
||||
if (m_Elements)
|
||||
{
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
newElements[i] = m_Elements[i];
|
||||
delete [] m_Elements;
|
||||
}
|
||||
m_Elements = newElements;
|
||||
}
|
||||
m_Elements[m_UsedSize++] = val;
|
||||
return true;
|
||||
}
|
||||
void pop()
|
||||
{
|
||||
--m_UsedSize;
|
||||
}
|
||||
|
||||
T &front()
|
||||
{
|
||||
return m_Elements[m_UsedSize - 1];
|
||||
}
|
||||
|
||||
const T &front() const
|
||||
{
|
||||
return m_Elements[m_UsedSize - 1];
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(this, 0);
|
||||
}
|
||||
iterator end()
|
||||
{
|
||||
return iterator(this, m_UsedSize);
|
||||
}
|
||||
|
||||
size_t size()
|
||||
{
|
||||
return m_UsedSize;
|
||||
}
|
||||
size_t capacity()
|
||||
{
|
||||
return m_AllocatedSize;
|
||||
}
|
||||
bool empty()
|
||||
{
|
||||
return m_UsedSize == 0 ? true : false;
|
||||
}
|
||||
bool reserve(size_t size)
|
||||
{
|
||||
if (size > m_AllocatedSize)
|
||||
{
|
||||
T *newElements = new T[size];
|
||||
if (!newElements)
|
||||
return false;
|
||||
if (m_Elements)
|
||||
{
|
||||
for (size_t i = 0; i < m_UsedSize; ++i)
|
||||
newElements[i] = m_Elements[i];
|
||||
delete [] m_Elements;
|
||||
}
|
||||
m_Elements = newElements;
|
||||
m_AllocatedSize = size;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
//}; //namespace SourceHook
|
||||
|
||||
#endif
|
@ -12,11 +12,8 @@
|
||||
//
|
||||
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "CVector.h"
|
||||
|
||||
#include <am-vector.h>
|
||||
#include "ham_const.h"
|
||||
#include "hooklist.h"
|
||||
#include "offsets.h"
|
||||
@ -25,7 +22,7 @@
|
||||
|
||||
|
||||
extern hook_t hooklist[];
|
||||
extern CVector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
extern ke::Vector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
||||
|
||||
void print_srvconsole(const char *fmt, ...)
|
||||
{
|
||||
@ -95,16 +92,12 @@ void HamCommand(void)
|
||||
int count = 0;
|
||||
for (int i=0; i<HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
||||
{
|
||||
CVector<Hook *>::iterator end=hooks[i].end();
|
||||
|
||||
for (CVector<Hook *>::iterator j=hooks[i].begin();
|
||||
j!=end;
|
||||
++j)
|
||||
for (size_t j = 0; j < hooks[i].length(); ++i)
|
||||
{
|
||||
HookCount++;
|
||||
ForwardCount+=(*j)->pre.size() + (*j)->post.size();
|
||||
ForwardCount += hooks[i].at(j)->pre.length() + hooks[i].at(j)->post.length();
|
||||
|
||||
print_srvconsole("%-24s | %-27s | %10d | %10d\n",hooklist[i].name, (*j)->ent, (*j)->pre.size(), (*j)->post.size());
|
||||
print_srvconsole("%-24s | %-27s | %10d | %10d\n", hooklist[i].name, hooks[i].at(j)->ent, hooks[i].at(j)->pre.length(), hooks[i].at(j)->post.length());
|
||||
if (count >= 5)
|
||||
{
|
||||
print_srvconsole("--------------------------------------------------------------------------------\n");
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include <extdll.h>
|
||||
#include "amxxmodule.h"
|
||||
|
||||
#include "CVector.h"
|
||||
|
||||
#include "hook.h"
|
||||
#include "forward.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user