1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2025-03-13 01:00:15 +01:00

Exclude reserve teams from cups by default

If you need to define a cup that includes reserve teams, you can add the
include_reserve_teams property to the cup definition.
This commit is contained in:
Tom Stellard 2020-09-21 20:06:43 -07:00
parent e3785995a5
commit 1ce850b0c7

View File

@ -481,6 +481,9 @@ cup_load_choose_team_from_league(Cup *cup, const League *league,
{ {
Team *team = team_of_id( Team *team = team_of_id(
g_array_index(table->elements, TableElement, j).team_id); g_array_index(table->elements, TableElement, j).team_id);
if (team_is_reserve_team(team) &&
!query_league_cup_has_property(cup->id, "include_reserve_teams"))
continue;
g_ptr_array_add(teams, team); g_ptr_array_add(teams, team);
g_ptr_array_add(cup->team_names, g_strdup(team->name)); g_ptr_array_add(cup->team_names, g_strdup(team->name));
} }
@ -500,6 +503,9 @@ 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); Team *team = team_of_id(g_array_index(table->elements, TableElement, order[j]).team_id);
if (team_is_reserve_team(team) &&
!query_league_cup_has_property(cup->id, "include_reserve_teams"))
continue;
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],