From 7324c289cc8d64ff923cff277b190087e089a4ae Mon Sep 17 00:00:00 2001 From: gyboth Date: Sun, 28 Dec 2008 10:24:54 +0000 Subject: [PATCH] Fixture scheduling bugfix. --- src/cup.c | 2 +- src/fixture.c | 5 +++-- src/league.c | 4 ++-- src/treeview.c | 5 +++-- src/xml_cup.c | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cup.c b/src/cup.c index 572f1a10..1db104b5 100644 --- a/src/cup.c +++ b/src/cup.c @@ -609,7 +609,7 @@ cup_load_choose_team_generate(Cup *cup, CupRound *cup_round, const CupChooseTeam if(number_of_teams == ct->number_of_teams) break; } - + if(((ct->number_of_teams != -1 && number_of_teams != ct->number_of_teams) || (ct->number_of_teams == -1 && number_of_teams != teams_local->len)) && teams_local->len > 0) diff --git a/src/fixture.c b/src/fixture.c index a7fcc2c2..392613a9 100644 --- a/src/fixture.c +++ b/src/fixture.c @@ -113,8 +113,7 @@ fixture_write_cup_fixtures(Cup *cup) gint i; - for(i=0;irounds->len;i++) - cup_get_team_pointers(cup, i); + cup_get_team_pointers(cup, 0); if(g_array_index(cup->rounds, CupRound, 0).round_robin_number_of_groups > 0) fixture_write_cup_round_robin( @@ -170,6 +169,7 @@ fixture_update(Cup *cup) } new_round = &g_array_index(cup->rounds, CupRound, round + 1); + cup_get_team_pointers(cup, round + 1); for(i=0;iteam_ptrs->len;i++) g_ptr_array_add(teams, g_ptr_array_index(new_round->team_ptrs, i)); @@ -696,6 +696,7 @@ fixture_write_knockout_round(Cup *cup, gint cup_round, GPtrArray *teams) week_number = (round->two_match_week) ? week_number : league_cup_get_week_with_break(cup->id, week_number + cup->week_gap); + week_round_number = fixture_get_free_round(week_number, teams, -1, -1); for(i=0; i<=(teams->len - 2) / 2; i++) diff --git a/src/league.c b/src/league.c index 52a861c6..86d866f6 100644 --- a/src/league.c +++ b/src/league.c @@ -1128,7 +1128,7 @@ league_cup_adjust_week_breaks(GArray *week_breaks, gint week_gap) gint i; for(i = 0; i < week_breaks->len; i++) - if(g_array_index(week_breaks, WeekBreak, i).length == -1) + if(g_array_index(week_breaks, WeekBreak, i).length == -1000) g_array_index(week_breaks, WeekBreak, i).length = week_gap; } @@ -1145,7 +1145,7 @@ league_cup_get_week_with_break(gint clid, gint week_number) for(i = 0; i < week_breaks->len; i++) if(g_array_index(week_breaks, WeekBreak, i).week_number == week_number) - return week_number + g_array_index(week_breaks, WeekBreak, i).length; + return week_number + g_array_index(week_breaks, WeekBreak, i).length; return week_number; } diff --git a/src/treeview.c b/src/treeview.c index ec26973f..1fe5d40e 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -1003,20 +1003,21 @@ treeview_create_fixtures_header(const Fixture *fix, GtkListStore *ls, gboolean b gchar *name = NULL; gchar *symbol = NULL; - sprintf(buf3, _("Week %d Round %d"), fix->week_number, fix->week_round_number); if(fix->clid < ID_CUP_START) { + sprintf(buf3, _("Week %d Round %d"), fix->week_number, fix->week_round_number); name = league_cup_get_name_string(fix->clid); strcpy(round_name, ""); symbol = league_from_clid(fix->clid)->symbol; } else { + sprintf(buf3, _("Week %d Round %d\nCup round %d"), + fix->week_number, fix->week_round_number, fix->round + 1); name = cup_from_clid(fix->clid)->name; cup_round_name(fix, buf); sprintf(round_name, "\n%s", buf); - strcat(buf3, "\n"); symbol = cup_from_clid(fix->clid)->symbol; } diff --git a/src/xml_cup.c b/src/xml_cup.c index 6842c78d..21d49d4f 100644 --- a/src/xml_cup.c +++ b/src/xml_cup.c @@ -175,7 +175,7 @@ xml_cup_read_start_element (GMarkupParseContext *context, if(attribute_names[0] != NULL && strcmp(attribute_names[0], ATT_DEF_NAME_WEEK_BREAK_LENGTH) == 0) new_week_break.length = (gint)g_ascii_strtod(attribute_values[0], NULL); else - new_week_break.length = -1; + new_week_break.length = -1000; } else if(strcmp(element_name, TAG_DEF_YELLOW_RED) == 0) state = STATE_YELLOW_RED;