Fixed IndexOfEdict and PEntityOfEntIndex inlines to be in line with updated edict_t structure in SDK

This commit is contained in:
Scott Ehlert 2008-11-14 23:08:24 -06:00
parent 41b61ed36f
commit 43f5d71724

View File

@ -123,13 +123,13 @@
#if SOURCE_ENGINE >= SE_LEFT4DEAD #if SOURCE_ENGINE >= SE_LEFT4DEAD
inline int IndexOfEdict(const edict_t *pEdict) inline int IndexOfEdict(const edict_t *pEdict)
{ {
return ((int)pEdict - (int)gpGlobals->baseEdict) >> 4; return (int)(pEdict - gpGlobals->baseEdict);
} }
inline edict_t *PEntityOfEntIndex(int iEntIndex) inline edict_t *PEntityOfEntIndex(int iEntIndex)
{ {
if (iEntIndex >= 0 && iEntIndex < gpGlobals->maxEntities) if (iEntIndex >= 0 && iEntIndex < gpGlobals->maxEntities)
{ {
return (edict_t *)((int)gpGlobals->baseEdict + (iEntIndex << 4)); return (edict_t *)(gpGlobals->baseEdict + iEntIndex);
} }
return NULL; return NULL;
} }