mirror of https://github.com/tstellar/bygfoot.git
Simplify some duplicated code in cup_load_choose_team_from_league()
This commit is contained in:
parent
4d5886da4b
commit
e3785995a5
22
src/cup.c
22
src/cup.c
|
@ -479,12 +479,10 @@ cup_load_choose_team_from_league(Cup *cup, const League *league,
|
||||||
{
|
{
|
||||||
for(j=0;j<table->elements->len;j++)
|
for(j=0;j<table->elements->len;j++)
|
||||||
{
|
{
|
||||||
g_ptr_array_add(
|
Team *team = team_of_id(
|
||||||
teams, team_of_id(
|
g_array_index(table->elements, TableElement, j).team_id);
|
||||||
g_array_index(table->elements, TableElement, j).team_id));
|
g_ptr_array_add(teams, team);
|
||||||
g_ptr_array_add(
|
g_ptr_array_add(cup->team_names, g_strdup(team->name));
|
||||||
cup->team_names,
|
|
||||||
g_strdup(team_of_id(g_array_index(table->elements, TableElement, j).team_id)->name));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -501,6 +499,7 @@ cup_load_choose_team_from_league(Cup *cup, const League *league,
|
||||||
|
|
||||||
for(j = 0; j < end; j++)
|
for(j = 0; j < end; j++)
|
||||||
{
|
{
|
||||||
|
Team *team = team_of_id(g_array_index(table->elements, TableElement, order[j]).team_id);
|
||||||
if(debug > 80)
|
if(debug > 80)
|
||||||
g_print("j %d order %d team %s isinint %d numteams %d\n",
|
g_print("j %d order %d team %s isinint %d numteams %d\n",
|
||||||
j, order[j],
|
j, order[j],
|
||||||
|
@ -512,15 +511,10 @@ cup_load_choose_team_from_league(Cup *cup, const League *league,
|
||||||
cup->group),
|
cup->group),
|
||||||
number_of_teams);
|
number_of_teams);
|
||||||
|
|
||||||
if(ct->skip_group_check ||
|
if(ct->skip_group_check || !query_team_is_in_cups(team, cup->group))
|
||||||
!query_team_is_in_cups(
|
|
||||||
team_of_id(g_array_index(table->elements, TableElement, order[j]).team_id), cup->group))
|
|
||||||
{
|
{
|
||||||
g_ptr_array_add(teams,
|
g_ptr_array_add(teams, team);
|
||||||
team_of_id(g_array_index(table->elements, TableElement, order[j]).team_id));
|
g_ptr_array_add(cup->team_names, g_strdup(team->name));
|
||||||
g_ptr_array_add(
|
|
||||||
cup->team_names,
|
|
||||||
g_strdup(team_of_id(g_array_index(table->elements, TableElement, order[j]).team_id)->name));
|
|
||||||
number_of_teams++;
|
number_of_teams++;
|
||||||
|
|
||||||
if(number_of_teams == ct->number_of_teams)
|
if(number_of_teams == ct->number_of_teams)
|
||||||
|
|
Loading…
Reference in New Issue