cups: Fix a bug in cups with only 2 teams playing in the first round

A cup in wich all teams get byes except for two in the first round
would not have any additional rounds added, because the teams with
byes were not being counted in the total number of teams remaining.
This commit is contained in:
Tom Stellard 2020-09-28 22:48:49 -07:00
parent 9d2440be85
commit 6061cd0938
1 changed files with 3 additions and 2 deletions

View File

@ -145,7 +145,7 @@ fixture_update(Cup *cup)
printf("fixture_update\n");
#endif
gint i;
gint i, teams_in_cup;
GArray *fixtures = cup->fixtures;
gint round = g_array_index(fixtures, Fixture, fixtures->len - 1).round;
gint replay = g_array_index(cup->rounds, CupRound, round).replay;
@ -188,7 +188,8 @@ fixture_update(Cup *cup)
for(i=0;i<new_round->team_ptrs->len;i++)
g_ptr_array_add(teams, g_ptr_array_index(new_round->team_ptrs, i));
if(teams->len < 2)
teams_in_cup = teams->len + (cup->bye ? cup->bye->len : 0);
if(teams_in_cup < 2)
{
g_ptr_array_free(teams, TRUE);
return;