corrected issue am44595

This commit is contained in:
David Anderson 2006-09-10 00:51:35 +00:00
parent 751e8e6299
commit 4599b59834
2 changed files with 17 additions and 4 deletions

View File

@ -3777,7 +3777,9 @@ static cell AMX_NATIVE_CALL CreateMultiForward(AMX *amx, cell *params)
cell ps[FORWARD_MAX_PARAMS]; cell ps[FORWARD_MAX_PARAMS];
cell count = params[0] / sizeof(cell); cell count = params[0] / sizeof(cell);
for (cell i=3; i<=count; i++) for (cell i=3; i<=count; i++)
{
ps[i-3] = *get_amxaddr(amx, params[i]); ps[i-3] = *get_amxaddr(amx, params[i]);
}
return registerForwardC(funcname, static_cast<ForwardExecType>(params[2]), ps, count-2); return registerForwardC(funcname, static_cast<ForwardExecType>(params[2]), ps, count-2);
} }
@ -3785,13 +3787,24 @@ static cell AMX_NATIVE_CALL CreateMultiForward(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL CreateOneForward(AMX *amx, cell *params) static cell AMX_NATIVE_CALL CreateOneForward(AMX *amx, cell *params)
{ {
CPluginMngr::CPlugin *p = g_plugins.findPlugin(params[1]); CPluginMngr::CPlugin *p = g_plugins.findPlugin(params[1]);
if (!p)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid plugin id: %d", params[1]);
return -1;
} else if (!p->isExecutable(0)) {
return -1;
}
int len; int len;
char *funcname = get_amxstring(amx, params[2], 0, len); char *funcname = get_amxstring(amx, params[2], 0, len);
cell ps[FORWARD_MAX_PARAMS]; cell ps[FORWARD_MAX_PARAMS];
cell count = params[0] / sizeof(cell); cell count = params[0] / sizeof(cell);
for (cell i=3; i<=count; i++) for (cell i=3; i<=count; i++)
{
ps[i-3] = *get_amxaddr(amx, params[i]); ps[i-3] = *get_amxaddr(amx, params[i]);
}
return registerSPForwardByNameC(p->getAMX(), funcname, ps, count-2); return registerSPForwardByNameC(p->getAMX(), funcname, ps, count-2);
} }

View File

@ -1004,10 +1004,10 @@ native set_addr_val(addr, val);
native CreateMultiForward(const name[], stop_type, ...); native CreateMultiForward(const name[], stop_type, ...);
/** /**
* creates a forward for one plugin. * Creates a forward for one plugin.
* results will be > 0 for success * Results will be > 0 for success.
* id can be returned from find_plugin_byfile or * id should be an id such as returned by find_plugin_byfile.
* anything get_plugin is compatible with. * Unlike get_plugin(), negative numbers will not work.
*/ */
native CreateOneForward(plugin_id, const name[], ...); native CreateOneForward(plugin_id, const name[], ...);