From 79a87f4cc8d2d9762d46994fc85dc2449f6eb1b2 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Thu, 22 Apr 2004 08:20:10 +0000 Subject: [PATCH] better float support --- amxmodx/CForward.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/amxmodx/CForward.cpp b/amxmodx/CForward.cpp index b08feb2c..fd2eda00 100755 --- a/amxmodx/CForward.cpp +++ b/amxmodx/CForward.cpp @@ -29,8 +29,6 @@ * version. */ -#include -#include #include "amxmodx.h" @@ -206,7 +204,7 @@ int registerForward(const char *funcName, ForwardExecType et, ...) { if (curParam == FORWARD_MAX_PARAMS) break; - tmp = va_arg(argptr, ForwardParam); + tmp = (ForwardParam)va_arg(argptr, int); if (tmp == FP_DONE) break; params[curParam] = tmp; @@ -227,7 +225,12 @@ int executeForwards(int id, ...) va_start(argptr, id); for (int i = 0; i < paramsNum && i < FORWARD_MAX_PARAMS; ++i) { - params[i] = va_arg(argptr, cell); + if (params[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); } va_end(argptr); return g_forwards.executeForwards(id, params);