Replace INDEXENT and ENTINDEX by TypeConversion for consistency

This commit is contained in:
Arkshine 2016-02-25 22:44:44 +01:00
parent 4c7375555a
commit aa2caacf4c
6 changed files with 33 additions and 33 deletions

View File

@ -200,7 +200,7 @@ bool CsItemInfo::GetAliasInfosFromName(const char *name, AliasInfo *info)
name += prefix_item_length + 1;
}
for (size_t id = 0; id < ARRAYSIZE(WeaponNameList); ++id)
for (size_t id = 0; id < ARRAYSIZE(WeaponsList); ++id)
{
const char *weapon = WeaponsList[id].name.chars();

View File

@ -115,7 +115,7 @@ static cell AMX_NATIVE_CALL cs_get_hostage_id(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pHostage = INDEXENT(index);
edict_t *pHostage = TypeConversion.id_to_edict(index);
CHECK_HOSTAGE(pHostage);
@ -131,7 +131,7 @@ static cell AMX_NATIVE_CALL cs_get_weapon_silenced(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pWeapon = INDEXENT(index);
edict_t *pWeapon = TypeConversion.id_to_edict(index);
switch (get_pdata<int>(pWeapon, m_iId))
{
@ -162,7 +162,7 @@ static cell AMX_NATIVE_CALL cs_get_weapon_id(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pWeapon = INDEXENT(index);
edict_t *pWeapon = TypeConversion.id_to_edict(index);
return get_pdata<int>(pWeapon, m_iId);
}
@ -177,7 +177,7 @@ static cell AMX_NATIVE_CALL cs_set_weapon_silenced(AMX *amx, cell *params)
int silence = params[2];
CHECK_NONPLAYER(index);
edict_t *pWeapon = INDEXENT(index);
edict_t *pWeapon = TypeConversion.id_to_edict(index);
int draw_animation = 1;
@ -231,7 +231,7 @@ static cell AMX_NATIVE_CALL cs_set_weapon_silenced(AMX *amx, cell *params)
if (draw_animation > 0 && UTIL_IsPlayer(pPlayer))
{
int currentWeapon = *static_cast<int *>(MF_PlayerPropAddr(ENTINDEX(pPlayer), Player_CurrentWeapon));
int currentWeapon = *static_cast<int *>(MF_PlayerPropAddr(TypeConversion.edict_to_id(pPlayer), Player_CurrentWeapon));
if (currentWeapon != weaponType)
{
@ -299,7 +299,7 @@ static cell AMX_NATIVE_CALL cs_get_weapon_burstmode(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pWeapon = INDEXENT(index);
edict_t *pWeapon = TypeConversion.id_to_edict(index);
int flag = 0;
@ -327,7 +327,7 @@ static cell AMX_NATIVE_CALL cs_set_weapon_burstmode(AMX *amx, cell *params)
int burst = params[2];
CHECK_NONPLAYER(index);
edict_t *pWeapon = INDEXENT(index);
edict_t *pWeapon = TypeConversion.id_to_edict(index);
int weaponState = get_pdata<int>(pWeapon, m_iWeaponState);
int weaponNewState = weaponState;
@ -908,7 +908,7 @@ static cell AMX_NATIVE_CALL cs_get_hostage_follow(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t* pHostage = INDEXENT(index);
edict_t* pHostage = TypeConversion.id_to_edict(index);
CHECK_HOSTAGE(pHostage);
@ -932,7 +932,7 @@ static cell AMX_NATIVE_CALL cs_get_hostage_follow(AMX *amx, cell *params)
pEntity = get_pdata<EHANDLE>(pHostage, m_hTargetEnt).Get();
}
return pEntity ? ENTINDEX(pEntity) : 0;
return pEntity ? TypeConversion.edict_to_id(pEntity) : 0;
}
// native cs_set_hostage_foll(index, followedindex = 0);
@ -945,7 +945,7 @@ static cell AMX_NATIVE_CALL cs_set_hostage_follow(AMX *amx, cell *params)
int target = params[2];
CHECK_NONPLAYER(index);
edict_t* pHostage = INDEXENT(index);
edict_t* pHostage = TypeConversion.id_to_edict(index);
if (target != 0)
{
@ -996,7 +996,7 @@ static cell AMX_NATIVE_CALL cs_get_weapon_ammo(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pWeapon = INDEXENT(index);
edict_t *pWeapon = TypeConversion.id_to_edict(index);
return get_pdata<int>(pWeapon, m_iClip);
}
@ -1010,7 +1010,7 @@ static cell AMX_NATIVE_CALL cs_set_weapon_ammo(AMX *amx, cell *params)
int ammo = params[2];
CHECK_NONPLAYER(index);
edict_t *pWeapon = INDEXENT(index);
edict_t *pWeapon = TypeConversion.id_to_edict(index);
set_pdata<int>(pWeapon, m_iClip, ammo);
@ -1185,7 +1185,7 @@ static cell AMX_NATIVE_CALL cs_get_armoury_type(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pArmoury = INDEXENT(index);
edict_t *pArmoury = TypeConversion.id_to_edict(index);
if (strcmp(STRING(pArmoury->v.classname), "armoury_entity"))
{
@ -1243,7 +1243,7 @@ static cell AMX_NATIVE_CALL cs_set_armoury_type(AMX *amx, cell *params)
int type = params[2];
CHECK_NONPLAYER(index);
edict_t *pArmoury = INDEXENT(index);
edict_t *pArmoury = TypeConversion.id_to_edict(index);
if (strcmp(STRING(pArmoury->v.classname), "armoury_entity"))
{
@ -1509,7 +1509,7 @@ static cell AMX_NATIVE_CALL cs_get_hostage_lastuse(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pHostage = INDEXENT(index);
edict_t *pHostage = TypeConversion.id_to_edict(index);
CHECK_HOSTAGE(pHostage);
@ -1535,7 +1535,7 @@ static cell AMX_NATIVE_CALL cs_set_hostage_lastuse(AMX *amx, cell *params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pHostage = INDEXENT(index);
edict_t *pHostage = TypeConversion.id_to_edict(index);
CHECK_HOSTAGE(pHostage);
@ -1562,7 +1562,7 @@ static cell AMX_NATIVE_CALL cs_get_hostage_nextuse(AMX* amx, cell* params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pHostage = INDEXENT(index);
edict_t *pHostage = TypeConversion.id_to_edict(index);
CHECK_HOSTAGE(pHostage);
@ -1577,7 +1577,7 @@ static cell AMX_NATIVE_CALL cs_set_hostage_nextuse(AMX* amx, cell* params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pHostage = INDEXENT(index);
edict_t *pHostage = TypeConversion.id_to_edict(index);
CHECK_HOSTAGE(pHostage);
@ -1594,7 +1594,7 @@ static cell AMX_NATIVE_CALL cs_get_c4_explode_time(AMX* amx, cell* params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pC4 = INDEXENT(index);
edict_t *pC4 = TypeConversion.id_to_edict(index);
if (strcmp(STRING(pC4->v.classname), "grenade") != 0)
{
@ -1613,7 +1613,7 @@ static cell AMX_NATIVE_CALL cs_set_c4_explode_time(AMX* amx, cell* params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pC4 = INDEXENT(index);
edict_t *pC4 = TypeConversion.id_to_edict(index);
if (strcmp(STRING(pC4->v.classname), "grenade") != 0)
{
@ -1634,7 +1634,7 @@ static cell AMX_NATIVE_CALL cs_get_c4_defusing(AMX* amx, cell* params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pC4 = INDEXENT(index);
edict_t *pC4 = TypeConversion.id_to_edict(index);
if (strcmp(STRING(pC4->v.classname), "grenade") != 0)
{
@ -1653,7 +1653,7 @@ static cell AMX_NATIVE_CALL cs_set_c4_defusing(AMX* amx, cell* params)
int index = params[1];
CHECK_NONPLAYER(index);
edict_t *pC4 = INDEXENT(index);
edict_t *pC4 = TypeConversion.id_to_edict(index);
if (strcmp(STRING(pC4->v.classname), "grenade") != 0)
{
@ -1682,7 +1682,7 @@ static cell AMX_NATIVE_CALL cs_create_entity(AMX* amx, cell* params)
if (!FNullEnt(pEnt))
{
return ENTINDEX(pEnt);
return TypeConversion.edict_to_id(pEnt);
}
return 0;

View File

@ -18,7 +18,7 @@ ke::Vector<int> ModelsUpdateQueue;
void ClientDisconnect(edict_t *pEntity)
{
int index = ENTINDEX(pEntity);
int index = TypeConversion.edict_to_id(pEntity);
Players[index].ResetModel();
Players[index].ResetZoom();
@ -30,7 +30,7 @@ void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer)
{
if (pEntity->pvPrivateData)
{
Players[ENTINDEX(pEntity)].UpdateModel(pEntity);
Players[TypeConversion.edict_to_id(pEntity)].UpdateModel(pEntity);
}
RETURN_META(MRES_IGNORED);

View File

@ -70,7 +70,7 @@ class CPlayer
{
MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer));
PostponeModelUpdate(ENTINDEX(pPlayer) - 1);
PostponeModelUpdate(TypeConversion.edict_to_id(pPlayer) - 1);
}
}
@ -85,7 +85,7 @@ class CPlayer
if (strcmp(GETCLIENTKEYVALUE(infobuffer, "model"), m_Model) != 0)
{
int index = ENTINDEX(pPlayer);
int index = TypeConversion.edict_to_id(pPlayer);
SETCLIENTKEYVALUE(index, infobuffer, "model", m_Model);

View File

@ -87,7 +87,7 @@ void OnMessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *p
{
if (msg_type == MessageIdSetFOV)
{
int index = ENTINDEX(pEntity);
int index = TypeConversion.edict_to_id(pEntity);
int zoom = Players[index].GetZoom();
if (zoom)
@ -107,7 +107,7 @@ void OnMessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *p
}
else if (msg_type == MessageIdResetHUD)
{
int index = ENTINDEX(pEntity);
int index = TypeConversion.edict_to_id(pEntity);
if (Players[index].GetZoom())
{

View File

@ -33,7 +33,7 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength);
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
return 0; \
} else { \
if (x != 0 && FNullEnt(INDEXENT(x))) { \
if (x != 0 && FNullEnt(TypeConversion.id_to_edict(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \
} \
@ -50,7 +50,7 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength);
return 0; \
} \
} else { \
if (x != 0 && FNullEnt(INDEXENT(x))) { \
if (x != 0 && FNullEnt(TypeConversion.id_to_edict(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \
} \
@ -73,7 +73,7 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength);
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
return 0; \
} else { \
if (FNullEnt(INDEXENT(x))) { \
if (FNullEnt(TypeConversion.id_to_edict(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
return 0; \
} \