From 8c8ccc51c470591f8f46005dd8b11d3f356bfe18 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Sat, 28 Aug 2004 21:25:29 +0000 Subject: [PATCH] Probably fixed problem with forwards getting garbage parameters --- amxmodx/CForward.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/amxmodx/CForward.cpp b/amxmodx/CForward.cpp index e76fcc69..f3e56ff3 100755 --- a/amxmodx/CForward.cpp +++ b/amxmodx/CForward.cpp @@ -103,6 +103,8 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays) else { realParams[i] = params[i]; + if (i == 0) + AMXXLOG_Log("CForward::execute called with %d", params[i]); } } // exec @@ -341,10 +343,16 @@ cell CForwardMngr::executeForwards(int id, cell *params) 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(); } +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() { for (ForwardVec::iterator iter = m_Forwards.begin(); iter != m_Forwards.end(); ++iter) @@ -447,12 +455,14 @@ cell executeForwards(int id, ...) va_start(argptr, id); 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 params[i] = *(cell*)&tmp; } params[i] = (cell)va_arg(argptr, cell); + if (i == 0) + AMXXLOG_Log("executeForwards called with %d", params[i]); } va_end(argptr); return g_forwards.executeForwards(id, params);