From eff4c7073970098d8195b45c378360544b765dc2 Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Fri, 28 Jul 2023 14:41:34 +0200 Subject: [PATCH] Change is_alive checks Add ent check to is_friend --- src/util.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/util.c b/src/util.c index 101851b..37fb4e3 100644 --- a/src/util.c +++ b/src/util.c @@ -22,8 +22,7 @@ cl_entity_t* get_player(int ent_idx) { } bool is_alive(cl_entity_t* ent) { - /* TODO */ - return ent && ent->curstate.movetype != 6 && ent->curstate.movetype != 0; + return ent && !player_extra_info[ent->index].dead; } bool valid_player(cl_entity_t* ent) { @@ -32,8 +31,8 @@ bool valid_player(cl_entity_t* ent) { } bool is_friend(cl_entity_t* ent) { - return !strcmp(player_extra_info[ent->index].teamname, - player_extra_info[localplayer->index].teamname); + return ent && !strcmp(player_extra_info[ent->index].teamname, + player_extra_info[localplayer->index].teamname); } char* get_name(int ent_idx) {