MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / GetHandleEntity

Method GetHandleEntity

core/HalfLife2.cpp:918–953  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

916}
917
918edict_t *CHalfLife2::GetHandleEntity(CBaseHandle &hndl)
919{
920 if (!hndl.IsValid())
921 {
922 return NULL;
923 }
924
925 int index = hndl.GetEntryIndex();
926
927 edict_t *pStoredEdict;
928 CBaseEntity *pStoredEntity;
929
930 if (!IndexToAThings(index, &pStoredEntity, &pStoredEdict))
931 {
932 return NULL;
933 }
934
935 if (pStoredEdict == NULL || pStoredEntity == NULL)
936 {
937 return NULL;
938 }
939
940 IServerEntity *pSE = pStoredEdict->GetIServerEntity();
941
942 if (pSE == NULL)
943 {
944 return NULL;
945 }
946
947 if (pSE->GetRefEHandle() != hndl)
948 {
949 return NULL;
950 }
951
952 return pStoredEdict;
953}
954
955void CHalfLife2::SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt)
956{

Callers 3

GetPlayerResourceEntityFunction · 0.80
ProcessCondChangeMethod · 0.80

Calls 2

IndexToAThingsFunction · 0.85
IsValidMethod · 0.45

Tested by

no test coverage detected