/* xml_mmatches.c Bygfoot Football Manager -- a small and simple GTK2-based football management game. http://bygfoot.sourceforge.net Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #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) { #ifdef DEBUG printf("xml_mmatches_start_element\n"); #endif 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); }