Fix cup_get_matchdays_in_cup_round

This commit is contained in:
markc77 2006-05-13 14:29:13 +00:00
parent f3b9966bcd
commit 2b926ce3e1
1 changed files with 9 additions and 8 deletions

View File

@ -727,15 +727,16 @@ cup_get_matchdays_in_cup_round(const Cup *cup, gint round)
if(cup_round->round_robin_number_of_groups > 0)
{
number_of_teams = cup_round_get_number_of_teams(cup, round);
if(number_of_teams % cup_round->round_robin_number_of_groups == 0)
number_of_matchdays =
((number_of_teams / cup_round->round_robin_number_of_groups) - 1) * 2;
number_of_teams += cup_round->round_robin_number_of_groups - 1;
number_of_teams /= cup_round->round_robin_number_of_groups;
/* Now, number_of_teams = number of teams in largest group */
if (number_of_teams % 2 == 0)
number_of_matchdays = number_of_teams - 1;
else
number_of_matchdays =
((number_of_teams -
(number_of_teams % cup_round->round_robin_number_of_groups)) /
cup_round->round_robin_number_of_groups) * 2;
number_of_matchdays = number_of_teams;
if (g_array_index(cup->rounds, CupRound, round).home_away)
number_of_matchdays *= 2;
}
else if(g_array_index(cup->rounds, CupRound, round).home_away)
number_of_matchdays = 2;