From 8a684b2f1d265f548c0278d88c480627d7e0161c Mon Sep 17 00:00:00 2001 From: gyboth Date: Sun, 25 Jan 2009 14:01:44 +0000 Subject: [PATCH] Joined league scheduling fix. --- src/fixture.c | 3 --- src/start_end.c | 11 ++++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fixture.c b/src/fixture.c index f71e6a60..d4afeaa2 100644 --- a/src/fixture.c +++ b/src/fixture.c @@ -55,9 +55,6 @@ fixture_write_league_fixtures(League *league) max_rr = league->round_robins; teams = team_get_pointers_from_array(league->teams, NULL); - g_array_free(league->fixtures, TRUE); - league->fixtures = g_array_new(FALSE, FALSE, sizeof(Fixture)); - /** Add all teams to the same pointer array. */ for(i = 0; i < league->joined_leagues->len; i++) { diff --git a/src/start_end.c b/src/start_end.c index 8994cb95..04e5d7b2 100644 --- a/src/start_end.c +++ b/src/start_end.c @@ -168,7 +168,16 @@ start_new_season(void) start_new_season_reset_ids(); } - + + /* We have to reset all fixture arrays beforehand because + of interleague scheduling (see joined_league). */ + for(i=0;ilen;i++) + if(query_league_active(&lig(i))) + { + g_array_free(lig(i).fixtures, TRUE); + lig(i).fixtures = g_array_new(FALSE, FALSE, sizeof(Fixture)); + } + for(i=0;ilen;i++) if(query_league_active(&lig(i))) fixture_write_league_fixtures(&lig(i));