mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
quick patch for dynamic native issues
This commit is contained in:
parent
3dcaa5742d
commit
33da5f3737
@ -44,11 +44,11 @@
|
|||||||
//With the exception for param_convert, which was written by
|
//With the exception for param_convert, which was written by
|
||||||
// Julien "dJeyL" Laurent
|
// Julien "dJeyL" Laurent
|
||||||
|
|
||||||
|
CStack<int> g_ErrorStk;
|
||||||
CVector<regnative *> g_RegNatives;
|
CVector<regnative *> g_RegNatives;
|
||||||
CStack<regnative *> g_NativeStack;
|
CStack<regnative *> g_NativeStack;
|
||||||
CVector<String> g_Libraries;
|
CVector<String> g_Libraries;
|
||||||
static char g_errorStr[512] = {0};
|
static char g_errorStr[512] = {0};
|
||||||
static int g_errorNum = 0;
|
|
||||||
bool g_Initialized = false;
|
bool g_Initialized = false;
|
||||||
|
|
||||||
int amxx_DynaCallback(int idx, AMX *amx, cell *params)
|
int amxx_DynaCallback(int idx, AMX *amx, cell *params)
|
||||||
@ -75,7 +75,7 @@ int amxx_DynaCallback(int idx, AMX *amx, cell *params)
|
|||||||
|
|
||||||
int err = 0;
|
int err = 0;
|
||||||
cell ret = 0;
|
cell ret = 0;
|
||||||
g_errorNum = 0;
|
g_ErrorStk.push(0);
|
||||||
g_NativeStack.push(pNative);
|
g_NativeStack.push(pNative);
|
||||||
if (pNative->style == 0)
|
if (pNative->style == 0)
|
||||||
{
|
{
|
||||||
@ -102,13 +102,15 @@ int amxx_DynaCallback(int idx, AMX *amx, cell *params)
|
|||||||
LogError(pNative->amx, err, NULL);
|
LogError(pNative->amx, err, NULL);
|
||||||
}
|
}
|
||||||
pNative->amx->error = AMX_ERR_NONE;
|
pNative->amx->error = AMX_ERR_NONE;
|
||||||
} else if (g_errorNum) {
|
//furthermore, log an error in the parent plugin.
|
||||||
g_NativeStack.pop();
|
LogError(amx, AMX_ERR_NATIVE, "Unhandled dynamic native error");
|
||||||
LogError(amx, g_errorNum, g_errorStr);
|
} else if (g_ErrorStk.front()) {
|
||||||
|
LogError(amx, g_ErrorStk.front(), g_errorStr);
|
||||||
}
|
}
|
||||||
if (pDebugger)
|
if (pDebugger)
|
||||||
pDebugger->EndExec();
|
pDebugger->EndExec();
|
||||||
g_NativeStack.pop();
|
g_NativeStack.pop();
|
||||||
|
g_ErrorStk.pop();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -142,7 +144,8 @@ static cell AMX_NATIVE_CALL log_error(AMX *amx, cell *params)
|
|||||||
char *err = format_amxstring(amx, params, 2, len);
|
char *err = format_amxstring(amx, params, 2, len);
|
||||||
|
|
||||||
_snprintf(g_errorStr, sizeof(g_errorStr), "%s", err);
|
_snprintf(g_errorStr, sizeof(g_errorStr), "%s", err);
|
||||||
g_errorNum = params[1];
|
g_ErrorStk.pop();
|
||||||
|
g_ErrorStk.push(params[1]);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user