| 961 | */ |
| 962 | |
| 963 | qboolean G_ValidEnemy( gentity_t *self, gentity_t *enemy ) |
| 964 | { |
| 965 | //Must be a valid pointer |
| 966 | if ( enemy == NULL ) |
| 967 | return qfalse; |
| 968 | |
| 969 | //Must not be me |
| 970 | if ( enemy == self ) |
| 971 | return qfalse; |
| 972 | |
| 973 | //Must not be deleted |
| 974 | if ( enemy->inuse == qfalse ) |
| 975 | return qfalse; |
| 976 | |
| 977 | //Must be alive |
| 978 | if ( enemy->health <= 0 ) |
| 979 | return qfalse; |
| 980 | |
| 981 | //In case they're in notarget mode |
| 982 | if ( enemy->flags & FL_NOTARGET ) |
| 983 | return qfalse; |
| 984 | |
| 985 | //Must be an NPC |
| 986 | if ( enemy->client == NULL ) |
| 987 | { |
| 988 | if ( enemy->svFlags&SVF_NONNPC_ENEMY ) |
| 989 | {//still potentially valid |
| 990 | if (self->client) |
| 991 | { |
| 992 | if ( enemy->noDamageTeam == self->client->playerTeam ) |
| 993 | { |
| 994 | return qfalse; |
| 995 | } |
| 996 | else |
| 997 | { |
| 998 | return qtrue; |
| 999 | } |
| 1000 | } |
| 1001 | else |
| 1002 | { |
| 1003 | if ( enemy->noDamageTeam == self->noDamageTeam ) |
| 1004 | { |
| 1005 | return qfalse; |
| 1006 | } |
| 1007 | else |
| 1008 | { |
| 1009 | return qtrue; |
| 1010 | } |
| 1011 | } |
| 1012 | } |
| 1013 | else |
| 1014 | { |
| 1015 | return qfalse; |
| 1016 | } |
| 1017 | } |
| 1018 | |
| 1019 | if ( enemy->client->playerTeam == TEAM_FREE && enemy->s.number < MAX_CLIENTS ) |
| 1020 | {//An evil player, everyone attacks him |
no outgoing calls
no test coverage detected