From 71483a7602deceff1f4acdc4a911a42f4620b42e Mon Sep 17 00:00:00 2001 From: gyboth Date: Mon, 16 May 2005 14:44:13 +0000 Subject: [PATCH] Minor bug fixed. --- src/game.c | 10 ++++++---- src/game.h | 4 ++-- src/live_game.c | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/game.c b/src/game.c index 67edd652..32f34b31 100644 --- a/src/game.c +++ b/src/game.c @@ -608,11 +608,12 @@ game_substitute_player(Team *tm, gint player_number) /** Find out whether we substitute a player to balance a team after a red card. + @param clid The cup/league id of the fixture. @param tm The team. @return A player index or -1 if we don't substitute. */ gint -game_find_to_substitute(const Team *tm) +game_find_to_substitute(gint clid, const Team *tm) { gint i; gint position_to_substitute = -1; @@ -624,7 +625,7 @@ game_find_to_substitute(const Team *tm) num_def = math_get_place(current_structure, 3); for(i=0;i<11;i++) - if(player_is_banned(player_of_idx_team(tm, i)) <= 0) + if(player_card_get(player_of_idx_team(tm, i), clid, PLAYER_VALUE_CARD_RED) <= 0) g_ptr_array_add(players, player_of_idx_team(tm, i)); g_ptr_array_sort_with_data(players, (GCompareDataFunc)player_compare_func, @@ -677,13 +678,14 @@ game_player_get_ban_duration(void) } /** Find out whether we make a sub after a send-off. + @param clid The id of the fixture. @param tm The team. @param player The player index. @param to_substitute The return location for the index of the player to substitute. @param substitute The return location for the player who comes into the game. */ void -game_substitute_player_send_off(Team *tm, gint player_number, +game_substitute_player_send_off(gint clid, Team *tm, gint player_number, gint *to_substitute, gint *substitute) { gint i; @@ -694,7 +696,7 @@ game_substitute_player_send_off(Team *tm, gint player_number, num_mid = math_get_place(current_structure, 2), num_def = math_get_place(current_structure, 3); - *to_substitute = game_find_to_substitute(tm); + *to_substitute = game_find_to_substitute(clid, tm); if(*to_substitute == -1) return; diff --git a/src/game.h b/src/game.h index 93eb139c..9c54f2a7 100644 --- a/src/game.h +++ b/src/game.h @@ -56,10 +56,10 @@ gfloat game_get_foul_possession_factor(gboolean boost1, gboolean boost2); gint -game_find_to_substitute(const Team *tm); +game_find_to_substitute(gint clid, const Team *tm); void -game_substitute_player_send_off(Team *tm, gint player_number, +game_substitute_player_send_off(gint clid, Team *tm, gint player_number, gint *to_substitute, gint *substitute); void game_decrease_fitness(const Fixture *fix); diff --git a/src/live_game.c b/src/live_game.c index 48f2dc29..a67e49e5 100644 --- a/src/live_game.c +++ b/src/live_game.c @@ -821,7 +821,8 @@ live_game_event_send_off(gint team, gint player, gboolean second_yellow) misc_callback_pause_live_game(); else if(tm[team]->players->len > 11) { - game_substitute_player_send_off(tm[team], player_id_index(tm[team], player), + game_substitute_player_send_off(match->fix->clid, + tm[team], player_id_index(tm[team], player), &to_substitute, &substitute); if(to_substitute != -1)