1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-01-05 17:13:36 +08:00

Fixed ENTINDEX/INDEXENT not compiling (bug 3543, r=ds).

This commit is contained in:
Fyren 2009-02-16 16:15:11 -05:00
parent 3e5d0a7960
commit 027b04693f

View File

@ -141,16 +141,21 @@ public:
// //
// Conversion among the three types of "entity", including identity-conversions. // Conversion among the three types of "entity", including identity-conversions.
// //
extern CGlobalVars *gpGlobals;
inline int ENTINDEX( edict_t *pEdict) inline int ENTINDEX( edict_t *pEdict)
{ {
return engine->IndexOfEdict(pEdict); return (int)(pEdict - gpGlobals->baseEdict);
} }
int ENTINDEX( CBaseEntity *pEnt ); int ENTINDEX( CBaseEntity *pEnt );
inline edict_t* INDEXENT( int iEdictNum ) inline edict_t* INDEXENT( int iEdictNum )
{ {
return engine->PEntityOfEntIndex(iEdictNum); if (iEdictNum >= 0 && iEdictNum < gpGlobals->maxEntities)
{
return (edict_t *)(gpGlobals->baseEdict + iEdictNum);
}
return NULL;
} }
// Testing the three types of "entity" for nullity // Testing the three types of "entity" for nullity