/* xml_loadsave_jobs.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 "job.h" #include "file.h" #include "free.h" #include "misc.h" #include "variables.h" #include "xml.h" #include "xml_loadsave_jobs.h" #include "xml_loadsave_teams.h" enum { TAG_JOBS = TAG_START_JOBS, TAG_JOB, TAG_JOB_TYPE, TAG_JOB_TIME, TAG_JOB_COUNTRY_FILE, TAG_JOB_COUNTRY_NAME, TAG_JOB_COUNTRY_RATING, TAG_JOB_LEAGUE_NAME, TAG_JOB_LEAGUE_LAYER, TAG_JOB_TALENT_PERCENT, TAG_JOB_TEAM_ID, TAG_END }; gint state; Job new_job; void xml_loadsave_jobs_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_jobs_start_element\n"); #endif gint i; gint tag = xml_get_tag_from_name(element_name); gboolean valid_tag = FALSE; for(i=TAG_JOBS;i\n", TAG_JOBS); for(i=0;ilen;i++) { fprintf(fil, "<_%d>\n", TAG_JOB); xml_write_int(fil, g_array_index(jobs, Job, i).type, TAG_JOB_TYPE, I1); xml_write_int(fil, g_array_index(jobs, Job, i).time, TAG_JOB_TIME, I1); if(g_array_index(jobs, Job, i).country_file != NULL) xml_write_string(fil, g_array_index(jobs, Job, i).country_file, TAG_JOB_COUNTRY_FILE, I1); if(g_array_index(jobs, Job, i).country_name != NULL) xml_write_string(fil, g_array_index(jobs, Job, i).country_name, TAG_JOB_COUNTRY_NAME, I1); xml_write_int(fil, g_array_index(jobs, Job, i).country_rating, TAG_JOB_COUNTRY_RATING, I1); if(g_array_index(jobs, Job, i).league_name != NULL) xml_write_string(fil, g_array_index(jobs, Job, i).league_name, TAG_JOB_LEAGUE_NAME, I1); xml_write_int(fil, g_array_index(jobs, Job, i).league_layer, TAG_JOB_LEAGUE_LAYER, I1); xml_write_int(fil, g_array_index(jobs, Job, i).talent_percent, TAG_JOB_TALENT_PERCENT, I1); xml_write_int(fil, g_array_index(jobs, Job, i).team_id, TAG_JOB_TEAM_ID, I1); fprintf(fil, "\n", TAG_JOB); } fprintf(fil, "\n", TAG_JOBS); fclose(fil); }