diff --git a/src/debug.c b/src/debug.c index 8b1c61af..03158279 100644 --- a/src/debug.c +++ b/src/debug.c @@ -110,8 +110,12 @@ debug_action(const gchar *text) else if(g_str_has_prefix(text, "goto")) { sett_set_int("int_opt_goto_mode", 1); - while(week < value) - on_button_new_week_clicked(NULL, NULL); + if(value < 100) + while(week < value) + on_button_new_week_clicked(NULL, NULL); + else + while(season < value - 100) + on_button_new_week_clicked(NULL, NULL); sett_set_int("int_opt_goto_mode", 0); } else if(g_str_has_prefix(text, "testcom") || diff --git a/src/fixture.c b/src/fixture.c index 7bf8268b..70be8cda 100644 --- a/src/fixture.c +++ b/src/fixture.c @@ -394,6 +394,9 @@ fixture_write_cup_round_robin(Cup *cup, gint cup_round, GPtrArray *teams) Table table_group[number_of_groups]; TableElement new_table_element; + if(debug > 100) + g_print("fixture_write_cup_round_robin: %s round %d teamlen %d\n", cup->name, cup_round, teams->len); + if(teams->len < number_of_groups) main_exit_program(EXIT_FIXTURE_WRITE_ERROR, "fixture_write_cup_round_robin: cup %s round %d: number of teams (%d) less than number of groups (%d)\n", diff --git a/src/xml_loadsave_cup.c b/src/xml_loadsave_cup.c index 1d0444b0..39ce0bb7 100644 --- a/src/xml_loadsave_cup.c +++ b/src/xml_loadsave_cup.c @@ -307,7 +307,7 @@ xml_loadsave_cup_text (GMarkupParseContext *context, &g_array_index(new_round.teams, Team, i)); } else if(state == TAG_CUP_ROUND_TEAM_PTR_ID) - g_ptr_array_add(new_round.team_ptrs, team_of_id(int_value)); + g_ptr_array_add(new_round.team_ptrs, GINT_TO_POINTER(int_value)); else if(state == TAG_CUP_ROUND_TABLE_FILE) { new_table = table_new(); diff --git a/src/xml_loadsave_fixtures.c b/src/xml_loadsave_fixtures.c index bd9e5a1f..367a7f2d 100644 --- a/src/xml_loadsave_fixtures.c +++ b/src/xml_loadsave_fixtures.c @@ -175,10 +175,7 @@ xml_loadsave_fixtures_text (GMarkupParseContext *context, else if(state == TAG_FIXTURE_RESULT) new_fixture.result[residx1][residx2] = int_value; else if(state == TAG_TEAM_ID) - { - new_fixture.teams[teamidx] = team_of_id(int_value); new_fixture.team_ids[teamidx] = int_value; - } } void diff --git a/src/xml_loadsave_leagues_cups.c b/src/xml_loadsave_leagues_cups.c index 00dafe75..3a6b81f7 100644 --- a/src/xml_loadsave_leagues_cups.c +++ b/src/xml_loadsave_leagues_cups.c @@ -28,6 +28,7 @@ #include "free.h" #include "league_struct.h" #include "misc.h" +#include "team.h" #include "xml.h" #include "xml_loadsave_cup.h" #include "xml_loadsave_league.h" @@ -163,6 +164,8 @@ xml_loadsave_leagues_cups_read(const gchar *dirname, const gchar *prefix) g_warning("xml_loadsave_misc_read: error parsing file %s\n", file); misc_print_error(&error, TRUE); } + + xml_loadsave_leagues_cups_adjust_team_ptrs(); } /** Write the leagues into xml files with the given prefix. */ @@ -203,3 +206,38 @@ xml_loadsave_leagues_cups_write(const gchar *prefix) g_free(basename); } + +void +xml_loadsave_leagues_cups_adjust_team_ptrs(void) +{ + gint i, j, k; + GPtrArray *team_ptrs; + + for(i = 0; i < ligs->len; i++) + { + for(j = 0; j < lig(i).fixtures->len; j++) + { + for(k = 0; k < 2; k++) + g_array_index(lig(i).fixtures, Fixture, j).teams[k] = team_of_id(g_array_index(lig(i).fixtures, Fixture, j).team_ids[k]); + } + } + + for(i = 0; i < cps->len; i++) + { + for(j = 0; j < cp(i).rounds->len; j++) + { + team_ptrs = g_ptr_array_new(); + for(k = 0; k < g_array_index(cp(i).rounds, CupRound, j).team_ptrs->len; k++) + g_ptr_array_add(team_ptrs, team_of_id(GPOINTER_TO_INT(g_ptr_array_index(g_array_index(cp(i).rounds, CupRound, j).team_ptrs, k)))); + + g_ptr_array_free(g_array_index(cp(i).rounds, CupRound, j).team_ptrs, TRUE); + g_array_index(cp(i).rounds, CupRound, j).team_ptrs = team_ptrs; + } + + for(j = 0; j < cp(i).fixtures->len; j++) + { + for(k = 0; k < 2; k++) + g_array_index(cp(i).fixtures, Fixture, j).teams[k] = team_of_id(g_array_index(cp(i).fixtures, Fixture, j).team_ids[k]); + } + } +} diff --git a/src/xml_loadsave_leagues_cups.h b/src/xml_loadsave_leagues_cups.h index 9d5da89c..eec14094 100644 --- a/src/xml_loadsave_leagues_cups.h +++ b/src/xml_loadsave_leagues_cups.h @@ -57,4 +57,7 @@ void xml_loadsave_leagues_cups_read(const gchar *dirname, const gchar *prefix); +void +xml_loadsave_leagues_cups_adjust_team_ptrs(void); + #endif diff --git a/support_files/definitions/europe/armenia/country_armenia.xml b/support_files/definitions/europe/armenia/country_armenia.xml index 0eb29a51..80957446 100755 --- a/support_files/definitions/europe/armenia/country_armenia.xml +++ b/support_files/definitions/europe/armenia/country_armenia.xml @@ -11,6 +11,7 @@ + armenia europe_uefa europe_champ_league supercup_league_vs_cup