*** empty log message ***
This commit is contained in:
parent
5db290890f
commit
4e1c5a3e02
|
@ -2454,7 +2454,7 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
||||||
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
PFN_LOG g_fn_Log;
|
PFN_LOG g_fn_Log;
|
||||||
PFN_LOG_ERROR g_fn_LogError;
|
PFN_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
|
@ -2544,7 +2544,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
REQFUNC("LogError", g_fn_LogError, PFN_LOG_ERROR);
|
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
|
||||||
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
|
@ -2651,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
|
|
|
@ -1990,7 +1990,7 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
||||||
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
extern PFN_LOG g_fn_Log;
|
extern PFN_LOG g_fn_Log;
|
||||||
extern PFN_LOG_ERROR g_fn_LogError;
|
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
|
@ -2106,7 +2106,7 @@ const char * MF_Format (const char *fmt, ...) { }
|
||||||
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
||||||
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
||||||
void MF_Log(const char *fmt, ...);
|
void MF_Log(const char *fmt, ...);
|
||||||
#define MF_LogError g_fn_LogError
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
||||||
#define MF_RegisterForward g_fn_RegisterForward
|
#define MF_RegisterForward g_fn_RegisterForward
|
||||||
#define MF_ExecuteForward g_fn_ExecuteForward
|
#define MF_ExecuteForward g_fn_ExecuteForward
|
||||||
|
|
|
@ -61,14 +61,17 @@ edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
|
||||||
#define CHECK_ENTITY(x) \
|
#define CHECK_ENTITY(x) \
|
||||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (x <= gpGlobals->maxClients) { \
|
if (x <= gpGlobals->maxClients) { \
|
||||||
if (!MF_IsPlayerIngame(x)) { \
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -76,18 +79,22 @@ edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
|
||||||
#define CHECK_PLAYER(x) \
|
#define CHECK_PLAYER(x) \
|
||||||
if (x < 1 || x > gpGlobals->maxClients) { \
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_NONPLAYER(x) \
|
#define CHECK_NONPLAYER(x) \
|
||||||
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (FNullEnt(INDEXENT(x))) { \
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2454,7 +2454,7 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
||||||
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
PFN_LOG g_fn_Log;
|
PFN_LOG g_fn_Log;
|
||||||
PFN_LOG_ERROR g_fn_LogError;
|
PFN_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
|
@ -2544,7 +2544,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
REQFUNC("LogError", g_fn_LogError, PFN_LOG_ERROR);
|
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
|
||||||
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
|
@ -2651,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
|
|
|
@ -1990,7 +1990,7 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
||||||
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
extern PFN_LOG g_fn_Log;
|
extern PFN_LOG g_fn_Log;
|
||||||
extern PFN_LOG_ERROR g_fn_LogError;
|
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
|
@ -2106,7 +2106,7 @@ const char * MF_Format (const char *fmt, ...) { }
|
||||||
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
||||||
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
||||||
void MF_Log(const char *fmt, ...);
|
void MF_Log(const char *fmt, ...);
|
||||||
#define MF_LogError g_fn_LogError
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
||||||
#define MF_RegisterForward g_fn_RegisterForward
|
#define MF_RegisterForward g_fn_RegisterForward
|
||||||
#define MF_ExecuteForward g_fn_ExecuteForward
|
#define MF_ExecuteForward g_fn_ExecuteForward
|
||||||
|
|
|
@ -114,14 +114,17 @@ edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
|
||||||
#define CHECK_ENTITY(x) \
|
#define CHECK_ENTITY(x) \
|
||||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (x <= gpGlobals->maxClients) { \
|
if (x <= gpGlobals->maxClients) { \
|
||||||
if (!MF_IsPlayerIngame(x)) { \
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -129,18 +132,22 @@ edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
|
||||||
#define CHECK_PLAYER(x) \
|
#define CHECK_PLAYER(x) \
|
||||||
if (x < 1 || x > gpGlobals->maxClients) { \
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_NONPLAYER(x) \
|
#define CHECK_NONPLAYER(x) \
|
||||||
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (FNullEnt(INDEXENT(x))) { \
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2454,7 +2454,7 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
||||||
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
PFN_LOG g_fn_Log;
|
PFN_LOG g_fn_Log;
|
||||||
PFN_LOG_ERROR g_fn_LogError;
|
PFN_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
|
@ -2544,7 +2544,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
REQFUNC("LogError", g_fn_LogError, PFN_LOG_ERROR);
|
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
|
||||||
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
|
@ -2651,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
|
|
|
@ -1990,7 +1990,7 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
||||||
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
extern PFN_LOG g_fn_Log;
|
extern PFN_LOG g_fn_Log;
|
||||||
extern PFN_LOG_ERROR g_fn_LogError;
|
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
|
@ -2106,7 +2106,7 @@ const char * MF_Format (const char *fmt, ...) { }
|
||||||
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
||||||
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
||||||
void MF_Log(const char *fmt, ...);
|
void MF_Log(const char *fmt, ...);
|
||||||
#define MF_LogError g_fn_LogError
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
||||||
#define MF_RegisterForward g_fn_RegisterForward
|
#define MF_RegisterForward g_fn_RegisterForward
|
||||||
#define MF_ExecuteForward g_fn_ExecuteForward
|
#define MF_ExecuteForward g_fn_ExecuteForward
|
||||||
|
|
|
@ -108,14 +108,17 @@ bool util_strncmp( const char *sz1, const char *sz2, int size);
|
||||||
#define CHECK_ENTITY(x) \
|
#define CHECK_ENTITY(x) \
|
||||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (x <= gpGlobals->maxClients) { \
|
if (x <= gpGlobals->maxClients) { \
|
||||||
if (!MF_IsPlayerIngame(x)) { \
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -123,18 +126,22 @@ bool util_strncmp( const char *sz1, const char *sz2, int size);
|
||||||
#define CHECK_PLAYER(x) \
|
#define CHECK_PLAYER(x) \
|
||||||
if (x < 1 || x > gpGlobals->maxClients) { \
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_NONPLAYER(x) \
|
#define CHECK_NONPLAYER(x) \
|
||||||
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (FNullEnt(INDEXENT(x))) { \
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2454,7 +2454,7 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
||||||
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
PFN_LOG g_fn_Log;
|
PFN_LOG g_fn_Log;
|
||||||
PFN_LOG_ERROR g_fn_LogError;
|
PFN_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
|
@ -2544,7 +2544,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
REQFUNC("LogError", g_fn_LogError, PFN_LOG_ERROR);
|
REQFUNC("LogError", g_fn_LogErrorFunc, PFN_LOG_ERROR);
|
||||||
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
|
@ -2651,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
|
|
|
@ -1990,7 +1990,7 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
||||||
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
extern PFN_LOG g_fn_Log;
|
extern PFN_LOG g_fn_Log;
|
||||||
extern PFN_LOG_ERROR g_fn_LogError;
|
extern PFN_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
|
@ -2106,7 +2106,7 @@ const char * MF_Format (const char *fmt, ...) { }
|
||||||
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
||||||
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
||||||
void MF_Log(const char *fmt, ...);
|
void MF_Log(const char *fmt, ...);
|
||||||
#define MF_LogError g_fn_LogError
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
||||||
#define MF_RegisterForward g_fn_RegisterForward
|
#define MF_RegisterForward g_fn_RegisterForward
|
||||||
#define MF_ExecuteForward g_fn_ExecuteForward
|
#define MF_ExecuteForward g_fn_ExecuteForward
|
||||||
|
|
|
@ -111,14 +111,17 @@ bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL);
|
||||||
#define CHECK_ENTITY(x) \
|
#define CHECK_ENTITY(x) \
|
||||||
if (x < 0 || x > gpGlobals->maxEntities) { \
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (x <= gpGlobals->maxClients) { \
|
if (x <= gpGlobals->maxClients) { \
|
||||||
if (!MF_IsPlayerIngame(x)) { \
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
@ -126,18 +129,22 @@ bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL);
|
||||||
#define CHECK_PLAYER(x) \
|
#define CHECK_PLAYER(x) \
|
||||||
if (x < 1 || x > gpGlobals->maxClients) { \
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_NONPLAYER(x) \
|
#define CHECK_NONPLAYER(x) \
|
||||||
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
||||||
|
return 0; \
|
||||||
} else { \
|
} else { \
|
||||||
if (FNullEnt(INDEXENT(x))) { \
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
return 0; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user