Cast player_extra_info depending on current game
This commit is contained in:
parent
3080b4dc2d
commit
db29d35966
22
src/util.c
22
src/util.c
|
@ -36,12 +36,26 @@ 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 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char* get_name(int ent_idx) {
|
char* get_name(int ent_idx) {
|
||||||
hud_player_info_t info;
|
hud_player_info_t info;
|
||||||
|
|
Loading…
Reference in New Issue