/* xml_loadsave_transfers.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 "misc.h" #include "team.h" #include "transfer.h" #include "xml.h" #include "xml_loadsave_transfers.h" enum { TAG_TRANSFERS = TAG_START_TRANSFERS, TAG_TRANSFER, TAG_TRANSFER_PLAYER_ID, TAG_TRANSFER_TIME, TAG_TRANSFER_FEE, TAG_TRANSFER_WAGE, TAG_TRANSFER_OFFER, TAG_TRANSFER_OFFER_TEAM_ID, TAG_TRANSFER_OFFER_FEE, TAG_TRANSFER_OFFER_WAGE, TAG_TRANSFER_OFFER_STATUS, TAG_END }; gint state, feeidx, wageidx; Transfer new_transfer; TransferOffer new_offer; void xml_loadsave_transfers_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_transfers_start_element\n"); #endif gint i; gint tag = xml_get_tag_from_name(element_name); gboolean valid_tag = FALSE; for(i=TAG_TRANSFERS;i\n", TAG_TRANSFERS); for(i=0;ilen;i++) { fprintf(fil, "<_%d>\n", TAG_TRANSFER); xml_write_int(fil, trans(i).tm->id, TAG_TEAM_ID, I1); xml_write_int(fil, trans(i).id, TAG_TRANSFER_PLAYER_ID, I1); xml_write_int(fil, trans(i).time, TAG_TRANSFER_TIME, I1); for(j=0;jlen;j++) { fprintf(fil, "%s<_%d>\n", I1, TAG_TRANSFER_OFFER); xml_write_int(fil, transoff(i, j).tm->id, TAG_TRANSFER_OFFER_TEAM_ID, I2); xml_write_int(fil, transoff(i, j).wage, TAG_TRANSFER_OFFER_WAGE, I2); xml_write_int(fil, transoff(i, j).status, TAG_TRANSFER_OFFER_STATUS, I2); xml_write_int(fil, transoff(i, j).fee, TAG_TRANSFER_OFFER_FEE, I2); fprintf(fil, "\n", TAG_TRANSFER_OFFER); } fprintf(fil, "%s\n", I1, TAG_TRANSFER); } fprintf(fil, "\n", TAG_TRANSFERS); fclose(fil); }