mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 06:45:37 +03:00
Allow [g|s]et_pdata_cbase usage at map end whereas player's private datas are still valid (following fakemeta behavior) (bug 5787, r=me)
This commit is contained in:
parent
7db35f0d97
commit
30394243ff
@ -31,6 +31,15 @@
|
|||||||
#include "NEW_Util.h"
|
#include "NEW_Util.h"
|
||||||
#include "ham_utils.h"
|
#include "ham_utils.h"
|
||||||
|
|
||||||
|
inline edict_t* INDEXENT2( int iEdictNum )
|
||||||
|
{
|
||||||
|
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
|
||||||
|
return MF_GetPlayerEdict(iEdictNum);
|
||||||
|
else
|
||||||
|
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
|
||||||
#define FM_CHECK_ENTITY(x) \
|
#define FM_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); \
|
||||||
@ -48,6 +57,16 @@
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FM_CHECK_ENTITY(x) \
|
||||||
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else if (x != 0 && FNullEnt(INDEXENT2(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
|
||||||
// Return -1 on null, -2 on invalid, and the the index of any other.
|
// Return -1 on null, -2 on invalid, and the the index of any other.
|
||||||
static cell AMX_NATIVE_CALL get_pdata_cbase_safe(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL get_pdata_cbase_safe(AMX *amx, cell *params)
|
||||||
|
Loading…
Reference in New Issue
Block a user