#include "file.h" #include "misc.h" #include "team.h" #include "user.h" #include "variables.h" #include "xml.h" #include "xml_loadsave_live_game.h" #include "xml_loadsave_users.h" enum { TAG_USERS = TAG_START_USERS, TAG_USER, TAG_USER_COUNTER, TAG_USER_MONEY, TAG_USER_DEBT, TAG_USER_MONEY_INS, TAG_USER_MONEY_IN, TAG_USER_MONEY_OUTS, TAG_USER_MONEY_OUT, TAG_USER_SCOUT, TAG_USER_PHYSIO, TAG_END }; gint state, idx_mon_in, idx_mon_out, idx; User new_user; void xml_loadsave_users_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_USERS;ilen;i++) { sprintf(buf, "%s___user_%02d_options", prefix, i); file_save_opt_file(buf, &usr(i).options); sprintf(buf, "%s___user_%02d_live_game.xml", prefix, i); xml_loadsave_live_game_write(buf, &usr(i).live_game); } sprintf(buf, "%s___users.xml", prefix); file_my_fopen(buf, "w", &fil, TRUE); fprintf(fil, "<_%d>\n", TAG_USERS); for(i=0;ilen;i++) { fprintf(fil, "<_%d>\n", TAG_USER); xml_write_g_string(fil, usr(i).name, TAG_NAME, I1); xml_write_int(fil, usr(i).team_id, TAG_TEAM_ID, I1); xml_write_int(fil, usr(i).money, TAG_USER_MONEY, I1); xml_write_int(fil, usr(i).debt, TAG_USER_DEBT, I1); xml_write_int(fil, usr(i).scout, TAG_USER_SCOUT, I1); xml_write_int(fil, usr(i).physio, TAG_USER_PHYSIO, I1); for(j=0;j\n", I1, TAG_USER_MONEY_INS); for(k=0;k\n", I1, TAG_USER_MONEY_INS); } for(j=0;j<2;j++) { fprintf(fil, "%s<_%d>\n", I1, TAG_USER_MONEY_OUTS); for(k=0;k\n", I1, TAG_USER_MONEY_OUTS); } fprintf(fil, "\n", TAG_USER); } fprintf(fil, "\n", TAG_USERS); fclose(fil); }