From 23fb53c5b8f4d81776b3175082bc245d9ab7c2f0 Mon Sep 17 00:00:00 2001 From: gyboth Date: Tue, 23 Dec 2008 10:33:55 +0000 Subject: [PATCH] Def improvements, Italian definition corrected. --- po/Makefile.in | 6 +- src/free.c | 25 +++- src/free.h | 3 + src/league.c | 121 ++++++++++-------- src/league.h | 8 +- src/league_struct.h | 32 +++-- src/xml_league.c | 19 ++- src/xml_loadsave_league.c | 68 ++++++---- src/xml_loadsave_league.h | 3 + .../europe/italy/country_italy.xml | 18 +-- ...ames1.xml => cup_italy_prom_games_2_1.xml} | 3 +- ...ames2.xml => cup_italy_prom_games_2_3.xml} | 3 +- ...mes3.xml => cup_italy_prom_games_3a_2.xml} | 3 +- ...mes5.xml => cup_italy_prom_games_3a_4.xml} | 5 +- ...mes4.xml => cup_italy_prom_games_3b_2.xml} | 3 +- ...mes6.xml => cup_italy_prom_games_3b_4.xml} | 5 +- ...mes7.xml => cup_italy_prom_games_4a_3.xml} | 3 +- ...mes8.xml => cup_italy_prom_games_4b_3.xml} | 3 +- ...mes9.xml => cup_italy_prom_games_4c_3.xml} | 3 +- .../europe/italy/league_italy2.xml | 20 ++- .../europe/italy/league_italy3a.xml | 19 ++- .../europe/italy/league_italy3b.xml | 19 ++- .../europe/italy/league_italy4a.xml | 2 +- .../europe/italy/league_italy4b.xml | 2 +- .../europe/italy/league_italy4c.xml | 2 +- 25 files changed, 258 insertions(+), 140 deletions(-) rename support_files/definitions/europe/italy/{cup_italy_prom_games1.xml => cup_italy_prom_games_2_1.xml} (90%) rename support_files/definitions/europe/italy/{cup_italy_prom_games2.xml => cup_italy_prom_games_2_3.xml} (89%) rename support_files/definitions/europe/italy/{cup_italy_prom_games3.xml => cup_italy_prom_games_3a_2.xml} (90%) mode change 100755 => 100644 rename support_files/definitions/europe/italy/{cup_italy_prom_games5.xml => cup_italy_prom_games_3a_4.xml} (87%) rename support_files/definitions/europe/italy/{cup_italy_prom_games4.xml => cup_italy_prom_games_3b_2.xml} (90%) mode change 100755 => 100644 rename support_files/definitions/europe/italy/{cup_italy_prom_games6.xml => cup_italy_prom_games_3b_4.xml} (87%) rename support_files/definitions/europe/italy/{cup_italy_prom_games7.xml => cup_italy_prom_games_4a_3.xml} (90%) rename support_files/definitions/europe/italy/{cup_italy_prom_games8.xml => cup_italy_prom_games_4b_3.xml} (90%) rename support_files/definitions/europe/italy/{cup_italy_prom_games9.xml => cup_italy_prom_games_4c_3.xml} (90%) diff --git a/po/Makefile.in b/po/Makefile.in index 809c72e4..3acb426b 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -54,14 +54,14 @@ INCLUDES = -I.. -I$(top_srcdir)/intl COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) SOURCES = -POFILES = de.po nl.po fr.po pl.po ro.po bg.po zh.po es.po da.po sv.po it.po -GMOFILES = de.gmo nl.gmo fr.gmo pl.gmo ro.gmo bg.gmo zh.gmo es.gmo da.gmo sv.gmo it.gmo +POFILES = de.po nl.po fr.po pl.po pt.po ro.po bg.po zh.po es.po da.po sv.po it.po +GMOFILES = de.gmo nl.gmo fr.gmo pl.gmo pt.gmo ro.gmo bg.gmo zh.gmo es.gmo da.gmo sv.gmo it.gmo DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \ $(POFILES) $(GMOFILES) $(SOURCES) POTFILES = \ -CATALOGS = de.gmo nl.gmo fr.gmo pl.gmo ro.gmo bg.gmo zh.gmo es.gmo da.gmo sv.gmo it.gmo +CATALOGS = de.gmo nl.gmo fr.gmo pl.gmo pt.gmo ro.gmo bg.gmo zh.gmo es.gmo da.gmo sv.gmo it.gmo CATOBJEXT = .gmo INSTOBJEXT = .mo diff --git a/src/free.c b/src/free.c index c5cdbd6d..55dfa1ca 100644 --- a/src/free.c +++ b/src/free.c @@ -381,16 +381,14 @@ free_league(League *league) free_gchar_ptr(league->short_name); free_gchar_ptr(league->symbol); free_gchar_ptr(league->sid); - free_gchar_ptr(league->prom_rel.prom_games_dest_sid); - free_gchar_ptr(league->prom_rel.prom_games_cup_sid); if(league->teams != NULL) free_teams_array(&league->teams, FALSE); free_joined_leagues(&league->joined_leagues); + free_prom_rel(&league->prom_rel); free_g_array(&league->teams); - free_g_array(&league->prom_rel.elements);; free_tables(&league->tables); free_new_tables(&league->new_tables); @@ -404,6 +402,27 @@ free_league(League *league) free_league_stats(&league->stats); } +/** Free the promotion/relegation struct of a league. */ +void +free_prom_rel(PromRel *prom_rel) +{ + gint i; + + for(i = 0; i < prom_rel->elements->len; i++) + g_free(g_array_index(prom_rel->elements, PromRelElement, i).dest_sid); + + free_g_array(&prom_rel->elements); + + for(i = 0; i < prom_rel->prom_games->len; i++) + { + g_free(g_array_index(prom_rel->prom_games, PromGames, i).dest_sid); + g_free(g_array_index(prom_rel->prom_games, PromGames, i).loser_sid); + g_free(g_array_index(prom_rel->prom_games, PromGames, i).cup_sid); + } + + free_g_array(&prom_rel->prom_games); +} + /** Free the data in the joined leagues array. */ void free_joined_leagues(GArray **joined_leagues) diff --git a/src/free.h b/src/free.h index 9bfb7ff9..73eadfb7 100644 --- a/src/free.h +++ b/src/free.h @@ -159,4 +159,7 @@ free_newspaper_article(NewsPaperArticle *article); void free_cup_round(CupRound *cup_round); +void +free_prom_rel(PromRel *prom_rel); + #endif diff --git a/src/league.c b/src/league.c index 833c6cfb..cb482da2 100644 --- a/src/league.c +++ b/src/league.c @@ -62,12 +62,8 @@ league_new(gboolean new_id) new.average_talent = 0; - new.prom_rel.prom_games_dest_sid = NULL; - new.prom_rel.prom_games_loser_sid = NULL; - new.prom_rel.prom_games_cup_sid = NULL; - new.prom_rel.prom_games_number_of_advance = 1; - new.prom_rel.elements = g_array_new(FALSE, FALSE, sizeof(PromRelElement)); + new.prom_rel.prom_games = g_array_new(FALSE, FALSE, sizeof(PromGames)); new.teams = g_array_new(FALSE, FALSE, sizeof(Team)); new.fixtures = g_array_new(FALSE, FALSE, sizeof(Fixture)); @@ -110,6 +106,27 @@ prom_rel_element_new(void) return new; } +/** + Create a new PromGames with default values. + @see PromGames +*/ +PromGames +prom_games_new(void) +{ +#ifdef DEBUG + printf("prom_games_new\n"); +#endif + + PromGames new; + + new.dest_sid = NULL; + new.loser_sid = NULL; + new.cup_sid = NULL; + new.number_of_advance = 1; + + return new; +} + /** Get the array index of the given league or cup id. @param clid The id of the league or cup. @return The index in the leagues or cups array. */ @@ -511,38 +528,41 @@ query_league_rank_in_prom_games(const League *league, gint rank) printf("query_league_rank_in_prom_games\n"); #endif - gint i, j, k; + gint i, j, k, l; const Cup *cup = NULL; const CupRound *cup_round = NULL; for(i=0;ilen;i++) if(query_league_has_prom_games((&lig(i)))) { - cup = cup_from_sid(lig(i).prom_rel.prom_games_cup_sid); - for(k=0;krounds->len;k++) - { - cup_round = &g_array_index(cup->rounds, CupRound, k); - for(j=0;jchoose_teams->len;j++) - { - if(strcmp(g_array_index(cup_round->choose_teams, CupChooseTeam, j).sid, - league->sid) == 0 && - ((rank >= g_array_index(cup_round->choose_teams, - CupChooseTeam, j).start_idx && - rank <= g_array_index(cup_round->choose_teams, - CupChooseTeam, j).end_idx && - g_array_index(cup_round->choose_teams, - CupChooseTeam, j).randomly) || - (rank >= g_array_index(cup_round->choose_teams, - CupChooseTeam, j).start_idx && - rank < g_array_index(cup_round->choose_teams, - CupChooseTeam, j).start_idx + - g_array_index(cup_round->choose_teams, - CupChooseTeam, j).number_of_teams && - !g_array_index(cup_round->choose_teams, - CupChooseTeam, j).randomly))) - return TRUE; - } - } + for(l = 0; l < lig(i).prom_rel.prom_games->len; l++) + { + cup = cup_from_sid(g_array_index(lig(i).prom_rel.prom_games, PromGames, l).cup_sid); + for(k=0;krounds->len;k++) + { + cup_round = &g_array_index(cup->rounds, CupRound, k); + for(j=0;jchoose_teams->len;j++) + { + if(strcmp(g_array_index(cup_round->choose_teams, CupChooseTeam, j).sid, + league->sid) == 0 && + ((rank >= g_array_index(cup_round->choose_teams, + CupChooseTeam, j).start_idx && + rank <= g_array_index(cup_round->choose_teams, + CupChooseTeam, j).end_idx && + g_array_index(cup_round->choose_teams, + CupChooseTeam, j).randomly) || + (rank >= g_array_index(cup_round->choose_teams, + CupChooseTeam, j).start_idx && + rank < g_array_index(cup_round->choose_teams, + CupChooseTeam, j).start_idx + + g_array_index(cup_round->choose_teams, + CupChooseTeam, j).number_of_teams && + !g_array_index(cup_round->choose_teams, + CupChooseTeam, j).randomly))) + return TRUE; + } + } + } } return FALSE; @@ -617,8 +637,9 @@ league_get_team_movements_prom_rel(const League *league, GArray *team_movements) /** Add the team movements from the promotion games to the array. */ void -league_get_team_movements_prom_games(const League *league, GArray *team_movements, - const GPtrArray *prom_games_teams, gboolean up) +league_get_team_movements_prom_games(const League *league, const PromGames *prom_games, + GArray *team_movements, const GPtrArray *prom_games_teams, + gboolean up) { #ifdef DEBUG printf("league_get_team_movements_prom_games\n"); @@ -627,18 +648,18 @@ league_get_team_movements_prom_games(const League *league, GArray *team_movement gint i, j; TeamMove new_move; GPtrArray *dest_sids = (up) ? - misc_separate_strings(league->prom_rel.prom_games_dest_sid) : - misc_separate_strings(league->prom_rel.prom_games_loser_sid); + misc_separate_strings(prom_games->dest_sid) : + misc_separate_strings(prom_games->loser_sid); GArray *dest_idcs = NULL; gint dest_idcs_int[dest_sids->len]; gint dest_idcs_order[dest_sids->len]; gint start_idx = 0, - end_idx = league->prom_rel.prom_games_number_of_advance; + end_idx = prom_games->number_of_advance; gint prom_type = PROM_REL_PROMOTION; if(!up) { - start_idx = league->prom_rel.prom_games_number_of_advance; + start_idx = prom_games->number_of_advance; end_idx = prom_games_teams->len; prom_type = PROM_REL_RELEGATION; } @@ -674,6 +695,7 @@ league_get_team_movements(League *league, GArray *team_movements) printf("league_get_team_movements\n"); #endif + gint i; GPtrArray *prom_games_teams = NULL; const Cup *prom_cup = NULL; @@ -681,24 +703,21 @@ league_get_team_movements(League *league, GArray *team_movements) if(query_league_has_prom_games(league)) { - prom_cup = cup_from_sid(league->prom_rel.prom_games_cup_sid); + for(i = 0; i < league->prom_rel.prom_games->len; i++) + { + prom_cup = cup_from_sid(g_array_index(league->prom_rel.prom_games, PromGames, i).cup_sid); - if(prom_cup == NULL) - { - g_warning("league_get_team_movements: promotion games cup not found for league %s (cup sid %s).\n", - league->name, league->prom_rel.prom_games_cup_sid); - return; - } + prom_games_teams = cup_get_teams_sorted(prom_cup); - prom_games_teams = cup_get_teams_sorted(prom_cup); + league_get_team_movements_prom_games(league, &g_array_index(league->prom_rel.prom_games, PromGames, i), + team_movements, prom_games_teams, TRUE); - league_get_team_movements_prom_games(league, team_movements, prom_games_teams, TRUE); - - if(league->prom_rel.prom_games_loser_sid != NULL) - league_get_team_movements_prom_games(league, team_movements, - prom_games_teams, FALSE); + if(g_array_index(league->prom_rel.prom_games, PromGames, i).loser_sid != NULL) + league_get_team_movements_prom_games(league, &g_array_index(league->prom_rel.prom_games, PromGames, i), + team_movements, prom_games_teams, FALSE); - g_ptr_array_free(prom_games_teams, TRUE); + g_ptr_array_free(prom_games_teams, TRUE); + } } g_array_sort_with_data(league->teams, team_compare_func, diff --git a/src/league.h b/src/league.h index 00b18aa8..f8baa214 100644 --- a/src/league.h +++ b/src/league.h @@ -38,7 +38,7 @@ #define league_table_cumul(league) (&g_array_index((league)->tables, Table, 0)) #define league_table(league) (&g_array_index((league)->tables, Table, league->tables->len - 1)) -#define query_league_has_prom_games(league) (league->prom_rel.prom_games_dest_sid != NULL) +#define query_league_has_prom_games(league) (league->prom_rel.prom_games->len > 0) #define query_league_active(league) (!query_league_cup_has_property((league)->id, "inactive")) /** A struct needed when managing promotions @@ -59,6 +59,9 @@ league_new(gboolean new_id); PromRelElement prom_rel_element_new(void); +PromGames +prom_games_new(void); + gint league_cup_get_index_from_clid(gint clid); @@ -105,7 +108,8 @@ void league_get_team_movements_prom_rel(const League *league, GArray *team_movements); void -league_get_team_movements_prom_games(const League *league, GArray *team_movements, +league_get_team_movements_prom_games(const League *league, const PromGames *prom_games, + GArray *team_movements, const GPtrArray *prom_games_teams, gboolean up); void diff --git a/src/league_struct.h b/src/league_struct.h index 29dc9c63..6403e03f 100644 --- a/src/league_struct.h +++ b/src/league_struct.h @@ -52,6 +52,22 @@ typedef struct gint type; /**< Type. Promotion or relegation or none. */ } PromRelElement; +/** + An element representing promotion/relegation games. +*/ +typedef struct +{ + /** The id of the league the promotion games winner gets promoted to. Default "" */ + gchar *dest_sid; + /** The id of the league the promotion games losers get moved to. Default "" */ + gchar *loser_sid; + /** Number of teams that advance from the promotion games. Default: 1. */ + gint number_of_advance; + /** The cup determining how the promotion games are handled. */ + gchar *cup_sid; + +} PromGames; + /** This structure specifies how promotion and relegation is handled in a league. It contains promotion and relegation rules in an array and possibly also @@ -60,22 +76,16 @@ typedef struct */ typedef struct { - /** The id of the league the promotion games winner gets promoted to. Default "" */ - gchar *prom_games_dest_sid; - - /** The id of the league the promotion games losers get moved to. Default "" */ - gchar *prom_games_loser_sid; - - /** Number of teams that advance from the promotion games. Default: 1. */ - gint prom_games_number_of_advance; - /** Array with promotion/relegation rules. @see PromRelElement */ GArray *elements; - /** The cup determining how the promotion games are handled. */ - gchar *prom_games_cup_sid; + /** Array with promotion/relegation games. + @see PromGames + */ + GArray *prom_games; + } PromRel; /** diff --git a/src/xml_league.c b/src/xml_league.c index dc623794..350637fe 100644 --- a/src/xml_league.c +++ b/src/xml_league.c @@ -151,6 +151,7 @@ xml_league_read_start_element (GMarkupParseContext *context, #endif PromRelElement new_element; + PromGames new_prom_games; Team new_team; JoinedLeague new_joined_league; NewTable new_table; @@ -214,7 +215,11 @@ xml_league_read_start_element (GMarkupParseContext *context, else if(strcmp(element_name, TAG_PROM_REL) == 0) state = STATE_PROM_REL; else if(strcmp(element_name, TAG_PROM_GAMES) == 0) - state = STATE_PROM_GAMES; + { + state = STATE_PROM_GAMES; + new_prom_games = prom_games_new(); + g_array_append_val(new_league.prom_rel.prom_games, new_prom_games); + } else if(strcmp(element_name, TAG_PROM_GAMES_DEST_SID) == 0) state = STATE_PROM_GAMES_DEST_SID; else if(strcmp(element_name, TAG_PROM_GAMES_LOSER_SID) == 0) @@ -394,13 +399,17 @@ xml_league_read_text (GMarkupParseContext *context, else if(state == STATE_TWO_MATCH_WEEK_END) g_array_append_val(new_league.two_match_weeks[1], int_value); else if(state == STATE_PROM_GAMES_DEST_SID) - misc_string_assign(&new_league.prom_rel.prom_games_dest_sid, buf); + g_array_index(new_league.prom_rel.prom_games, PromGames, + new_league.prom_rel.prom_games->len - 1).dest_sid = g_strdup(buf); else if(state == STATE_PROM_GAMES_LOSER_SID) - misc_string_assign(&new_league.prom_rel.prom_games_loser_sid, buf); + g_array_index(new_league.prom_rel.prom_games, PromGames, + new_league.prom_rel.prom_games->len - 1).loser_sid = g_strdup(buf); else if(state == STATE_PROM_GAMES_NUMBER_OF_ADVANCE) - new_league.prom_rel.prom_games_number_of_advance = int_value; + g_array_index(new_league.prom_rel.prom_games, PromGames, + new_league.prom_rel.prom_games->len - 1).number_of_advance = int_value; else if(state == STATE_PROM_GAMES_CUP_SID) - misc_string_assign(&new_league.prom_rel.prom_games_cup_sid, buf); + g_array_index(new_league.prom_rel.prom_games, PromGames, + new_league.prom_rel.prom_games->len - 1).cup_sid = g_strdup(buf); else if(state == STATE_PROM_REL_ELEMENT_RANK_START) g_array_index(new_league.prom_rel.elements, PromRelElement, diff --git a/src/xml_loadsave_league.c b/src/xml_loadsave_league.c index 877a8f8d..77091c23 100644 --- a/src/xml_loadsave_league.c +++ b/src/xml_loadsave_league.c @@ -45,11 +45,11 @@ enum TAG_LEAGUE_ROUND_ROBINS, TAG_LEAGUE_AVERAGE_TALENT, TAG_LEAGUE_PROM_REL, + TAG_LEAGUE_PROM_GAMES, TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID, TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID, TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID, TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE, - TAG_LEAGUE_PROM_REL_CUP, TAG_LEAGUE_PROM_REL_ELEMENTS, TAG_LEAGUE_PROM_REL_ELEMENT, TAG_LEAGUE_PROM_REL_ELEMENT_RANK, @@ -69,6 +69,7 @@ enum gint promrankidx, state; PromRelElement new_element; +PromGames new_prom_games; League *new_league; gchar *dirname; @@ -110,6 +111,9 @@ xml_loadsave_league_start_element (GMarkupParseContext *context, promrankidx = 0; } + if(tag == TAG_LEAGUE_PROM_GAMES) + new_prom_games = prom_games_new(); + if(tag == TAG_LEAGUE_JOINED_LEAGUE_SID) g_array_append_val(new_league->joined_leagues, new_joined_league); @@ -160,13 +164,18 @@ xml_loadsave_league_end_element (GMarkupParseContext *context, tag == TAG_YELLOW_RED || tag == TAG_LEAGUE_PROM_REL) state = TAG_LEAGUE; + else if(tag == TAG_LEAGUE_PROM_GAMES || + tag == TAG_LEAGUE_PROM_REL_ELEMENTS) + { + state = TAG_LEAGUE_PROM_REL; + if(tag == TAG_LEAGUE_PROM_GAMES) + g_array_append_val(new_league->prom_rel.prom_games, new_prom_games); + } else if(tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID || tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID || tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID || - tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE || - tag == TAG_LEAGUE_PROM_REL_CUP || - tag == TAG_LEAGUE_PROM_REL_ELEMENTS) - state = TAG_LEAGUE_PROM_REL; + tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE) + state = TAG_LEAGUE_PROM_GAMES; else if(tag == TAG_LEAGUE_PROM_REL_ELEMENT) { state = TAG_LEAGUE_PROM_REL_ELEMENTS; @@ -265,13 +274,13 @@ xml_loadsave_league_text (GMarkupParseContext *context, else if(state == TAG_LEAGUE_AVERAGE_TALENT) new_league->average_talent = float_value; else if(state == TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID) - misc_string_assign(&new_league->prom_rel.prom_games_dest_sid, buf); + new_prom_games.dest_sid = g_strdup(buf); else if(state == TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID) - misc_string_assign(&new_league->prom_rel.prom_games_cup_sid, buf); + new_prom_games.cup_sid = g_strdup(buf); else if(state == TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE) - new_league->prom_rel.prom_games_number_of_advance = int_value; + new_prom_games.number_of_advance = int_value; else if(state == TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID) - misc_string_assign(&new_league->prom_rel.prom_games_loser_sid, buf); + new_prom_games.loser_sid = g_strdup(buf); else if(state == TAG_LEAGUE_PROM_REL_ELEMENT_RANK) new_element.ranks[promrankidx] = int_value; else if(state == TAG_LEAGUE_PROM_REL_ELEMENT_TYPE) @@ -403,16 +412,36 @@ xml_loadsave_league_write(const gchar *prefix, const League *league) TAG_LEAGUE_TWO_MATCH_WEEK_END, I0); } + xml_loadsave_league_prom_rel_write(fil, league); + + fprintf(fil, "%s\n", I0, TAG_LEAGUE); + + fclose(fil); +} + +/** Write the prom_rel data into the file. */ +void +xml_loadsave_league_prom_rel_write(FILE *fil, const League *league) +{ + gint i; + fprintf(fil, "%s<_%d>\n", I0, TAG_LEAGUE_PROM_REL); - xml_write_string(fil, league->prom_rel.prom_games_dest_sid, - TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID, I1); - xml_write_string(fil, league->prom_rel.prom_games_cup_sid, - TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID, I1); - xml_write_int(fil, league->prom_rel.prom_games_number_of_advance, - TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE, I1); - xml_write_string(fil, league->prom_rel.prom_games_loser_sid, - TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID, I1); + for(i = 0; i < league->prom_rel.prom_games->len; i++) + { + fprintf(fil, "%s<_%d>\n", I1, TAG_LEAGUE_PROM_GAMES); + + xml_write_string(fil, g_array_index(league->prom_rel.prom_games, PromGames, i).dest_sid, + TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID, I2); + xml_write_string(fil, g_array_index(league->prom_rel.prom_games, PromGames, i).cup_sid, + TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID, I2); + xml_write_int(fil, g_array_index(league->prom_rel.prom_games, PromGames, i).number_of_advance, + TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE, I2); + xml_write_string(fil, g_array_index(league->prom_rel.prom_games, PromGames, i).loser_sid, + TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID, I2); + + fprintf(fil, "%s\n", I1, TAG_LEAGUE_PROM_GAMES); + } fprintf(fil, "%s<_%d>\n", I1, TAG_LEAGUE_PROM_REL_ELEMENTS); for(i=0;iprom_rel.elements->len;i++) @@ -434,9 +463,4 @@ xml_loadsave_league_write(const gchar *prefix, const League *league) fprintf(fil, "%s\n", I0, TAG_LEAGUE_PROM_REL); - fprintf(fil, "%s\n", I0, TAG_LEAGUE); - - fclose(fil); } - - diff --git a/src/xml_loadsave_league.h b/src/xml_loadsave_league.h index 21a4cce7..fc45af45 100644 --- a/src/xml_loadsave_league.h +++ b/src/xml_loadsave_league.h @@ -56,4 +56,7 @@ xml_loadsave_league_write(const gchar *prefix, const League *league); void xml_loadsave_league_read(const gchar *filename, const gchar *team_file, League *league); +void +xml_loadsave_league_prom_rel_write(FILE *fil, const League *league); + #endif diff --git a/support_files/definitions/europe/italy/country_italy.xml b/support_files/definitions/europe/italy/country_italy.xml index 3777c71a..a3440a9b 100644 --- a/support_files/definitions/europe/italy/country_italy.xml +++ b/support_files/definitions/europe/italy/country_italy.xml @@ -22,15 +22,15 @@ supercup_league_vs_cup supercup_europe_uefa supercup_europe_intercontinental - italy_prom_games1 - italy_prom_games2 - italy_prom_games3 - italy_prom_games4 - italy_prom_games5 - italy_prom_games6 - italy_prom_games7 - italy_prom_games8 - italy_prom_games9 + italy_prom_games_2_1 + italy_prom_games_2_3 + italy_prom_games_3a_2 + italy_prom_games_3b_2 + italy_prom_games_3a_4 + italy_prom_games_3b_4 + italy_prom_games_4a_3 + italy_prom_games_4b_3 + italy_prom_games_4c_3 diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games1.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_2_1.xml similarity index 90% rename from support_files/definitions/europe/italy/cup_italy_prom_games1.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_2_1.xml index 39ed427b..45e12f76 100644 --- a/support_files/definitions/europe/italy/cup_italy_prom_games1.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_2_1.xml @@ -3,10 +3,11 @@ Serie B Promotion Serie B Prom. flag_italy.png - italy_prom_games1 + italy_prom_games_2_1 1000 national highlight2 + promotion diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games2.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_2_3.xml similarity index 89% rename from support_files/definitions/europe/italy/cup_italy_prom_games2.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_2_3.xml index c0cd7e79..f6385b73 100644 --- a/support_files/definitions/europe/italy/cup_italy_prom_games2.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_2_3.xml @@ -3,10 +3,11 @@ Serie B Relegation Serie B Rel. flag_italy.png - italy_prom_games2 + italy_prom_games_2_3 1000 national highlight2 + promotion diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games3.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_3a_2.xml old mode 100755 new mode 100644 similarity index 90% rename from support_files/definitions/europe/italy/cup_italy_prom_games3.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_3a_2.xml index c392fb6c..1385e384 --- a/support_files/definitions/europe/italy/cup_italy_prom_games3.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_3a_2.xml @@ -3,10 +3,11 @@ Prima Divisione A Promotion Pr. Div. A Prom. flag_italy.png - italy_prom_games3 + italy_prom_games_3a_2 1000 national highlight2 + promotion diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games5.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_3a_4.xml similarity index 87% rename from support_files/definitions/europe/italy/cup_italy_prom_games5.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_3a_4.xml index 4061363e..ae5826c9 100644 --- a/support_files/definitions/europe/italy/cup_italy_prom_games5.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_3a_4.xml @@ -3,16 +3,15 @@ Prima Divisione A Relegation Pr. Div. A Rel. flag_italy.png - italy_prom_games5 + italy_prom_games_3a_4 1000 national highlight2 + promotion 1 - 2 - italy3a diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games4.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_3b_2.xml old mode 100755 new mode 100644 similarity index 90% rename from support_files/definitions/europe/italy/cup_italy_prom_games4.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_3b_2.xml index 5e9aa826..1205b48c --- a/support_files/definitions/europe/italy/cup_italy_prom_games4.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_3b_2.xml @@ -3,10 +3,11 @@ Prima Divisione B Promotion Pr. Div. B Prom. flag_italy.png - italy_prom_games4 + italy_prom_games_3b_2 1000 national highlight2 + promotion diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games6.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_3b_4.xml similarity index 87% rename from support_files/definitions/europe/italy/cup_italy_prom_games6.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_3b_4.xml index be14d49b..fbef0302 100644 --- a/support_files/definitions/europe/italy/cup_italy_prom_games6.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_3b_4.xml @@ -3,16 +3,15 @@ Prima Divisione B Relegation Pr. Div. B Rel. flag_italy.png - italy_prom_games6 + italy_prom_games_3b_4 1000 national highlight2 + promotion 1 - 2 - italy3b diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games7.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_4a_3.xml similarity index 90% rename from support_files/definitions/europe/italy/cup_italy_prom_games7.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_4a_3.xml index 7645471b..e43d53a3 100644 --- a/support_files/definitions/europe/italy/cup_italy_prom_games7.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_4a_3.xml @@ -3,10 +3,11 @@ Seconda Divisione A Promotion S. Div. A Prom. flag_italy.png - italy_prom_games7 + italy_prom_games_4a_3 1000 national highlight2 + promotion diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games8.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_4b_3.xml similarity index 90% rename from support_files/definitions/europe/italy/cup_italy_prom_games8.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_4b_3.xml index 518cca8e..96293e3e 100644 --- a/support_files/definitions/europe/italy/cup_italy_prom_games8.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_4b_3.xml @@ -3,10 +3,11 @@ Seconda Divisione B Promotion S. Div. B Prom. flag_italy.png - italy_prom_games8 + italy_prom_games_4b_3 1000 national highlight2 + promotion diff --git a/support_files/definitions/europe/italy/cup_italy_prom_games9.xml b/support_files/definitions/europe/italy/cup_italy_prom_games_4c_3.xml similarity index 90% rename from support_files/definitions/europe/italy/cup_italy_prom_games9.xml rename to support_files/definitions/europe/italy/cup_italy_prom_games_4c_3.xml index 3bf557f4..1bf5fbc9 100644 --- a/support_files/definitions/europe/italy/cup_italy_prom_games9.xml +++ b/support_files/definitions/europe/italy/cup_italy_prom_games_4c_3.xml @@ -3,10 +3,11 @@ Seconda Divisione C Promotion S. Div. C Prom. flag_italy.png - italy_prom_games9 + italy_prom_games_4c_3 1000 national highlight2 + promotion diff --git a/support_files/definitions/europe/italy/league_italy2.xml b/support_files/definitions/europe/italy/league_italy2.xml index 70a2848c..dc75304c 100644 --- a/support_files/definitions/europe/italy/league_italy2.xml +++ b/support_files/definitions/europe/italy/league_italy2.xml @@ -20,6 +20,18 @@ 35 + + + italy1 + italy_prom_games_2_1 + + + + italy2 + italy3a italy3b + italy_prom_games_2_3 + + 1 2 @@ -27,13 +39,9 @@ promotion - - italy1 - italy_prom_games1 - - - 19 + + 20 22 italy3a italy3b relegation diff --git a/support_files/definitions/europe/italy/league_italy3a.xml b/support_files/definitions/europe/italy/league_italy3a.xml index f49a9ff6..2e3a2652 100644 --- a/support_files/definitions/europe/italy/league_italy3a.xml +++ b/support_files/definitions/europe/italy/league_italy3a.xml @@ -13,6 +13,18 @@ 3 + + italy2 + italy_prom_games_3a_2 + + + + italy3a + italy4a italy4b italy4c + italy_prom_games_3a_4 + 2 + + 1 1 @@ -20,13 +32,8 @@ promotion - - italy2 - italy_prom_games3 - - - 16 + 18 18 italy4a italy4b italy4c relegation diff --git a/support_files/definitions/europe/italy/league_italy3b.xml b/support_files/definitions/europe/italy/league_italy3b.xml index cda0aad1..a5f55498 100644 --- a/support_files/definitions/europe/italy/league_italy3b.xml +++ b/support_files/definitions/europe/italy/league_italy3b.xml @@ -13,6 +13,18 @@ 3 + + italy2 + italy_prom_games_3b_2 + + + + italy3b + italy4a italy4b italy4c + italy_prom_games_3b_4 + 2 + + 1 1 @@ -20,13 +32,8 @@ promotion - - italy2 - italy_prom_games4 - - - 16 + 18 18 italy4a italy4b italy4c relegation diff --git a/support_files/definitions/europe/italy/league_italy4a.xml b/support_files/definitions/europe/italy/league_italy4a.xml index 4b6d8050..87b5d839 100644 --- a/support_files/definitions/europe/italy/league_italy4a.xml +++ b/support_files/definitions/europe/italy/league_italy4a.xml @@ -22,7 +22,7 @@ italy3a italy3b - italy_prom_games7 + italy_prom_games_4a_3 diff --git a/support_files/definitions/europe/italy/league_italy4b.xml b/support_files/definitions/europe/italy/league_italy4b.xml index cba31c56..0f513f43 100644 --- a/support_files/definitions/europe/italy/league_italy4b.xml +++ b/support_files/definitions/europe/italy/league_italy4b.xml @@ -22,7 +22,7 @@ italy3a italy3b - italy_prom_games8 + italy_prom_games_4b_3 diff --git a/support_files/definitions/europe/italy/league_italy4c.xml b/support_files/definitions/europe/italy/league_italy4c.xml index 7e1d2e62..435dfbff 100644 --- a/support_files/definitions/europe/italy/league_italy4c.xml +++ b/support_files/definitions/europe/italy/league_italy4c.xml @@ -22,7 +22,7 @@ italy3a italy3b - italy_prom_games9 + italy_prom_games_4c_3