changes so forward ids can be mapped back to names
This commit is contained in:
parent
c6d16eac7a
commit
f3fe58809d
|
@ -56,6 +56,8 @@ CForward::CForward(const char *name, ForwardExecType et, int numParams, const Fo
|
||||||
m_Funcs.push_back(tmp);
|
m_Funcs.push_back(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_Name.assign(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
||||||
|
@ -210,12 +212,16 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
||||||
|
|
||||||
void CSPForward::Set(int func, AMX *amx, int numParams, const ForwardParam *paramTypes)
|
void CSPForward::Set(int func, AMX *amx, int numParams, const ForwardParam *paramTypes)
|
||||||
{
|
{
|
||||||
|
char name[sNAMEMAX];
|
||||||
m_Func = func;
|
m_Func = func;
|
||||||
m_Amx = amx;
|
m_Amx = amx;
|
||||||
m_NumParams = numParams;
|
m_NumParams = numParams;
|
||||||
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
|
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
|
||||||
m_HasFunc = true;
|
m_HasFunc = true;
|
||||||
isFree = false;
|
isFree = false;
|
||||||
|
name[0] = '\0';
|
||||||
|
amx_GetPublic(amx, func, name);
|
||||||
|
m_Name.assign(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const ForwardParam *paramTypes)
|
void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const ForwardParam *paramTypes)
|
||||||
|
@ -225,6 +231,7 @@ void CSPForward::Set(const char *funcName, AMX *amx, int numParams, const Forwar
|
||||||
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
|
memcpy((void *)m_ParamTypes, paramTypes, numParams * sizeof(ForwardParam));
|
||||||
m_HasFunc = (amx_FindPublic(amx, funcName, &m_Func) == AMX_ERR_NONE);
|
m_HasFunc = (amx_FindPublic(amx, funcName, &m_Func) == AMX_ERR_NONE);
|
||||||
isFree = false;
|
isFree = false;
|
||||||
|
m_Name.assign(funcName);
|
||||||
}
|
}
|
||||||
|
|
||||||
cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
||||||
|
@ -445,6 +452,11 @@ cell CForwardMngr::executeForwards(int id, cell *params)
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *CForwardMngr::getFuncName(int id) const
|
||||||
|
{
|
||||||
|
return (id & 1) ? m_SPForwards[id >> 1]->getFuncName() : m_Forwards[id >> 1]->getFuncName();
|
||||||
|
}
|
||||||
|
|
||||||
int CForwardMngr::getParamsNum(int id) const
|
int CForwardMngr::getParamsNum(int id) const
|
||||||
{
|
{
|
||||||
return (id & 1) ? m_SPForwards[id >> 1]->getParamsNum() : m_Forwards[id >> 1]->getParamsNum();
|
return (id & 1) ? m_SPForwards[id >> 1]->getParamsNum() : m_Forwards[id >> 1]->getParamsNum();
|
||||||
|
|
|
@ -93,6 +93,7 @@ class CForward
|
||||||
const char *m_FuncName;
|
const char *m_FuncName;
|
||||||
ForwardExecType m_ExecType;
|
ForwardExecType m_ExecType;
|
||||||
int m_NumParams;
|
int m_NumParams;
|
||||||
|
String m_Name;
|
||||||
|
|
||||||
struct AMXForward
|
struct AMXForward
|
||||||
{
|
{
|
||||||
|
@ -120,6 +121,11 @@ public:
|
||||||
{
|
{
|
||||||
return m_Funcs.size();
|
return m_Funcs.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *getFuncName() const
|
||||||
|
{
|
||||||
|
return m_Name.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
ForwardParam getParamType(int paramId) const
|
ForwardParam getParamType(int paramId) const
|
||||||
{
|
{
|
||||||
|
@ -141,6 +147,7 @@ class CSPForward
|
||||||
|
|
||||||
int m_Func;
|
int m_Func;
|
||||||
bool m_HasFunc;
|
bool m_HasFunc;
|
||||||
|
String m_Name;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool isFree;
|
bool isFree;
|
||||||
|
@ -160,6 +167,11 @@ public:
|
||||||
{
|
{
|
||||||
return (m_HasFunc) ? 1 : 0;
|
return (m_HasFunc) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *getFuncName() const
|
||||||
|
{
|
||||||
|
return m_Name.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
ForwardParam getParamType(int paramId) const
|
ForwardParam getParamType(int paramId) const
|
||||||
{
|
{
|
||||||
|
@ -207,6 +219,7 @@ public:
|
||||||
bool isSPForward(int id) const; // check whether forward is single plugin
|
bool isSPForward(int id) const; // check whether forward is single plugin
|
||||||
int getParamsNum(int id) const; // get num of params of a forward
|
int getParamsNum(int id) const; // get num of params of a forward
|
||||||
int getFuncsNum(int id) const; // get num of found functions of a forward
|
int getFuncsNum(int id) const; // get num of found functions of a forward
|
||||||
|
const char *getFuncName(int id) const; // get the function name
|
||||||
|
|
||||||
ForwardParam getParamType(int id, int paramId) const;
|
ForwardParam getParamType(int id, int paramId) const;
|
||||||
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, bool copyBack); // prepare array
|
cell prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, bool copyBack); // prepare array
|
||||||
|
|
Loading…
Reference in New Issue
Block a user