| 916 | } |
| 917 | |
| 918 | edict_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 | |
| 955 | void CHalfLife2::SetHandleEntity(CBaseHandle &hndl, edict_t *pEnt) |
| 956 | { |
no test coverage detected