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;
/* Check the current game because this method only works for some games */
if (this_game_id == CS || this_game_id == TF)
return player_extra_info[ent->index].teamnumber ==
player_extra_info[localplayer->index].teamnumber;
else
return false;
switch (this_game_id) {
case TF: {
extra_player_info_t* info = (extra_player_info_t*)player_extra_info;
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) {