better float support

This commit is contained in:
Pavol Marko 2004-04-22 08:20:10 +00:00
parent 85b0e04ca3
commit 79a87f4cc8

View File

@ -29,8 +29,6 @@
* version. * version.
*/ */
#include <extdll.h>
#include <meta_api.h>
#include "amxmodx.h" #include "amxmodx.h"
@ -206,7 +204,7 @@ int registerForward(const char *funcName, ForwardExecType et, ...)
{ {
if (curParam == FORWARD_MAX_PARAMS) if (curParam == FORWARD_MAX_PARAMS)
break; break;
tmp = va_arg(argptr, ForwardParam); tmp = (ForwardParam)va_arg(argptr, int);
if (tmp == FP_DONE) if (tmp == FP_DONE)
break; break;
params[curParam] = tmp; params[curParam] = tmp;
@ -227,7 +225,12 @@ int 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)
{ {
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); va_end(argptr);
return g_forwards.executeForwards(id, params); return g_forwards.executeForwards(id, params);