Cast player_extra_info depending on current game

This commit is contained in:
8dcc 2023-07-28 16:31:30 +02:00
parent 3080b4dc2d
commit db29d35966
1 changed files with 19 additions and 5 deletions

View File

@ -36,11 +36,25 @@ bool is_friend(cl_entity_t* ent) {
return false; return false;
/* Check the current game because this method only works for some games */ /* Check the current game because this method only works for some games */
if (this_game_id == CS || this_game_id == TF) switch (this_game_id) {
return player_extra_info[ent->index].teamnumber == case TF: {
player_extra_info[localplayer->index].teamnumber; extra_player_info_t* info = (extra_player_info_t*)player_extra_info;
else
return false; return info[ent->index].teamnumber ==
info[localplayer->index].teamnumber;
}
case CS: {
extra_player_info_cs_t* info =
(extra_player_info_cs_t*)player_extra_info;
return info[ent->index].teamnumber ==
info[localplayer->index].teamnumber;
}
case HL:
case DOD:
default:
return false;
}
} }
char* get_name(int ent_idx) { char* get_name(int ent_idx) {