mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 06:45:37 +03:00
registerSPForward now returing -1 if no func found
This commit is contained in:
parent
388915e6f8
commit
1df654c6a1
@ -293,8 +293,10 @@ int CForwardMngr::registerSPForward(int func, AMX *amx, int numParams, const For
|
|||||||
if (!m_FreeSPForwards.empty())
|
if (!m_FreeSPForwards.empty())
|
||||||
{
|
{
|
||||||
pForward = m_SPForwards[m_FreeSPForwards.front() >> 1];
|
pForward = m_SPForwards[m_FreeSPForwards.front() >> 1];
|
||||||
m_FreeSPForwards.pop();
|
|
||||||
pForward->Set(func, amx, numParams, paramTypes);
|
pForward->Set(func, amx, numParams, paramTypes);
|
||||||
|
if (pForward->getFuncsNum() == 0)
|
||||||
|
return -1;
|
||||||
|
m_FreeSPForwards.pop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -302,13 +304,14 @@ int CForwardMngr::registerSPForward(int func, AMX *amx, int numParams, const For
|
|||||||
if (!pForward)
|
if (!pForward)
|
||||||
return -1;
|
return -1;
|
||||||
pForward->Set(func, amx, numParams, paramTypes);
|
pForward->Set(func, amx, numParams, paramTypes);
|
||||||
|
if (pForward->getFuncsNum() == 0)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
delete pForward;
|
||||||
|
}
|
||||||
|
|
||||||
m_SPForwards.push_back(pForward);
|
m_SPForwards.push_back(pForward);
|
||||||
}
|
}
|
||||||
if (pForward->getFuncsNum() == 0)
|
|
||||||
{
|
|
||||||
unregisterSPForward(retVal);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,9 +322,11 @@ int CForwardMngr::registerSPForward(const char *funcName, AMX *amx, int numParam
|
|||||||
if (!m_FreeSPForwards.empty())
|
if (!m_FreeSPForwards.empty())
|
||||||
{
|
{
|
||||||
retVal = m_FreeSPForwards.front();
|
retVal = m_FreeSPForwards.front();
|
||||||
m_FreeSPForwards.pop();
|
|
||||||
pForward = m_SPForwards[retVal>>1]; // >>1 because unregisterSPForward pushes the id which contains the sp flag
|
pForward = m_SPForwards[retVal>>1]; // >>1 because unregisterSPForward pushes the id which contains the sp flag
|
||||||
pForward->Set(funcName, amx, numParams, paramTypes);
|
pForward->Set(funcName, amx, numParams, paramTypes);
|
||||||
|
if (pForward->getFuncsNum() == 0)
|
||||||
|
return -1;
|
||||||
|
m_FreeSPForwards.pop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -329,6 +334,11 @@ int CForwardMngr::registerSPForward(const char *funcName, AMX *amx, int numParam
|
|||||||
if (!pForward)
|
if (!pForward)
|
||||||
return -1;
|
return -1;
|
||||||
pForward->Set(funcName, amx, numParams, paramTypes);
|
pForward->Set(funcName, amx, numParams, paramTypes);
|
||||||
|
if (pForward->getFuncsNum() == 0)
|
||||||
|
{
|
||||||
|
delete pForward;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
m_SPForwards.push_back(pForward);
|
m_SPForwards.push_back(pForward);
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
|
Loading…
Reference in New Issue
Block a user