/* xml_loadsave_fixtures.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 "fixture.h" #include "misc.h" #include "team.h" #include "variables.h" #include "xml.h" #include "xml_loadsave_fixtures.h" enum { TAG_FIXTURES = TAG_START_FIXTURES, TAG_FIXTURE, TAG_FIXTURE_REPLAY_NUMBER, TAG_FIXTURE_ID, TAG_FIXTURE_WEEK_NUMBER, TAG_FIXTURE_WEEK_ROUND_NUMBER, TAG_FIXTURE_RESULT, TAG_FIXTURE_HOME_ADVANTAGE, TAG_FIXTURE_SECOND_LEG, TAG_FIXTURE_DECISIVE, TAG_FIXTURE_ATTENDANCE, TAG_END }; gint state, residx1, residx2, teamidx, nameidx; Fixture new_fixture; GArray *fixtures_array; void xml_loadsave_fixtures_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_loadsave_fixtures_start_element\n"); #endif gint i; gint tag = xml_get_tag_from_name(element_name); gboolean valid_tag = FALSE; for(i=TAG_FIXTURES;i\n", TAG_FIXTURES); for(i=0;ilen;i++) { fprintf(fil, "<_%d>\n", TAG_FIXTURE); xml_write_int(fil, g_array_index(fixtures, Fixture, i).clid, TAG_ID, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).round, TAG_ROUND, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).replay_number, TAG_FIXTURE_REPLAY_NUMBER, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).id, TAG_FIXTURE_ID, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).week_number, TAG_FIXTURE_WEEK_NUMBER, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).week_round_number, TAG_FIXTURE_WEEK_ROUND_NUMBER, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).home_advantage, TAG_FIXTURE_HOME_ADVANTAGE, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).second_leg, TAG_FIXTURE_SECOND_LEG, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).decisive, TAG_FIXTURE_DECISIVE, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).attendance, TAG_FIXTURE_ATTENDANCE, I1); for(j=0;j<2;j++) { xml_write_int(fil, g_array_index(fixtures, Fixture, i).result[j][0], TAG_FIXTURE_RESULT, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).result[j][1], TAG_FIXTURE_RESULT, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).result[j][2], TAG_FIXTURE_RESULT, I1); xml_write_int(fil, g_array_index(fixtures, Fixture, i).team_ids[j], TAG_TEAM_ID, I1); } fprintf(fil, "\n", TAG_FIXTURE); } fprintf(fil, "\n", TAG_FIXTURES); fclose(fil); }