#include "file.h" #include "free.h" #include "live_game.h" #include "misc.h" #include "user.h" #include "xml.h" #include "xml_mmatches.h" #include "xml_loadsave_live_game.h" enum { TAG_MMATCHES = 0, TAG_MMATCH, TAG_MMATCHES_COUNTRY_NAME, TAG_MMATCHES_COMP_NAME, TAG_MMATCHES_NEUTRAL, TAG_MMATCHES_USER_TEAM, TAG_MMATCHES_LG_FILE, TAG_END }; /** * The state variable used in the XML parsing functions. */ gint state; MemMatch new_match; gchar *dirname; GArray *mm_array; void xml_mmatches_start_element (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error) { gint i; gint tag = xml_get_tag_from_name(element_name); gboolean valid_tag = FALSE; for(i=TAG_MMATCHES;i\n", TAG_MMATCHES); for(i=0;ilen;i++) { fprintf(fil, "<_%d>\n", TAG_MMATCH); xml_write_g_string(fil, g_array_index(mmatches, MemMatch, i).competition_name, TAG_MMATCHES_COMP_NAME, I1); xml_write_string(fil, g_array_index(mmatches, MemMatch, i).country_name, TAG_MMATCHES_COUNTRY_NAME, I1); xml_write_int(fil, g_array_index(mmatches, MemMatch, i).neutral, TAG_MMATCHES_NEUTRAL, I1); xml_write_int(fil, g_array_index(mmatches, MemMatch, i).user_team, TAG_MMATCHES_USER_TEAM, I1); sprintf(buf, "%slg%03d", basename, i); xml_write_string(fil, buf, TAG_MMATCHES_LG_FILE, I1); sprintf(buf, "%slg%03d", prefix, i); xml_loadsave_live_game_write(buf, &g_array_index(mmatches, MemMatch, i).lg); fprintf(fil, "\n", TAG_MMATCH); } fprintf(fil, "\n", TAG_MMATCHES); fclose(fil); g_free(basename); }