Added new debug mode to fun module, also cleaned up error checking code

This commit is contained in:
David Anderson
2004-10-03 20:19:47 +00:00
parent fc15ac1f41
commit 62e4bbcfe9
4 changed files with 122 additions and 240 deletions

View File

@ -60,3 +60,30 @@ bool g_ResetHUDbool;
edict_t* g_edict;
//bool g_bot[33]; // is user bot? <--- removed, only needed with akimbot
// Globals above
#define CHECK_ENTITY(x) \
if (x <= 0 || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
} else { \
if (x <= gpGlobals->maxClients) { \
if (!MF_IsPlayerIngame(x)) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
} \
} else { \
if (FNullEnt(INDEXENT(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
} \
} \
}
#define CHECK_PLAYER(x) \
if (x < 1 || x > gpGlobals->maxClients) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
} else { \
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
} \
}
#define GETEDICT(n) \
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))