Probably fixed problem with forwards getting garbage parameters

This commit is contained in:
Pavol Marko 2004-08-28 21:25:29 +00:00
parent c7982c2bc3
commit 8c8ccc51c4

View File

@ -103,6 +103,8 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
else else
{ {
realParams[i] = params[i]; realParams[i] = params[i];
if (i == 0)
AMXXLOG_Log("CForward::execute called with %d", params[i]);
} }
} }
// exec // exec
@ -341,10 +343,16 @@ cell CForwardMngr::executeForwards(int id, cell *params)
int CForwardMngr::getParamsNum(int id) const int CForwardMngr::getParamsNum(int id) const
{ {
return (id & 1) ? m_SPForwards[id >> 1]->getParamsNum() : return (id & 1) ? m_SPForwards[id >> 1]->getParamsNum() :
m_Forwards[id >> 1]->getParamsNum(); m_Forwards[id >> 1]->getParamsNum();
} }
ForwardParam CForwardMngr::getParamType(int id, int paramNum) const
{
return (id & 1) ? m_SPForwards[id >> 1]->getParamType(paramNum) :
m_Forwards[id >> 1]->getParamType(paramNum);
}
void CForwardMngr::clear() void CForwardMngr::clear()
{ {
for (ForwardVec::iterator iter = m_Forwards.begin(); iter != m_Forwards.end(); ++iter) for (ForwardVec::iterator iter = m_Forwards.begin(); iter != m_Forwards.end(); ++iter)
@ -447,12 +455,14 @@ cell executeForwards(int id, ...)
va_start(argptr, id); va_start(argptr, id);
for (int i = 0; i < paramsNum && i < FORWARD_MAX_PARAMS; ++i) for (int i = 0; i < paramsNum && i < FORWARD_MAX_PARAMS; ++i)
{ {
if (params[i] == FP_FLOAT) if (g_forwards.getParamType(id, i) == FP_FLOAT)
{ {
REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles
params[i] = *(cell*)&tmp; params[i] = *(cell*)&tmp;
} }
params[i] = (cell)va_arg(argptr, cell); params[i] = (cell)va_arg(argptr, cell);
if (i == 0)
AMXXLOG_Log("executeForwards called with %d", params[i]);
} }
va_end(argptr); va_end(argptr);
return g_forwards.executeForwards(id, params); return g_forwards.executeForwards(id, params);