No cups fixes.

This commit is contained in:
gyboth 2005-04-06 08:49:55 +00:00
parent 34e1c33e23
commit 7a29699be3
6 changed files with 14 additions and 9 deletions

View File

@ -23,7 +23,7 @@ bygfoot_SOURCES = \
league.c cup.h league.h table.h team.h variables.h \ league.c cup.h league.h table.h team.h variables.h \
live_game.c fixture.h free.h game.h game_gui.h live_game.h maths.h misc_callback_func.h option.h player.h support.h team.h treeview.h user.h variables.h window.h \ live_game.c fixture.h free.h game.h game_gui.h live_game.h maths.h misc_callback_func.h option.h player.h support.h team.h treeview.h user.h variables.h window.h \
load_save.c file.h gui.h load_save.h option.h support.h variables.h xml_loadsave_misc.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_transfers.h xml_loadsave_users.h xml.h \ load_save.c file.h gui.h load_save.h option.h support.h variables.h xml_loadsave_misc.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_transfers.h xml_loadsave_users.h xml.h \
main.c misc_callbacks.h file.h free.h live_game.h main.h transfer_struct.h variables.h window.h \ main.c cup_struct.h misc_callbacks.h file.h free.h league_struct.h live_game.h main.h transfer_struct.h variables.h window.h \
maths.c maths.h misc.h \ maths.c maths.h misc.h \
misc.c main.h maths.h misc.h \ misc.c main.h maths.h misc.h \
misc_callbacks.c callbacks.h callback_func.h game.h game_gui.h live_game.h load_save.h main.h misc_callback_func.h misc_callbacks.h option.h user.h variables.h window.h xml_name.h \ misc_callbacks.c callbacks.h callback_func.h game.h game_gui.h live_game.h load_save.h main.h misc_callback_func.h misc_callbacks.h option.h user.h variables.h window.h xml_name.h \

View File

@ -52,7 +52,7 @@ cup_new_id(void)
{ {
gint i, j; gint i, j;
if(cps == NULL) if(cps->len == 0)
return ID_CUP_START; return ID_CUP_START;
for(i=ID_CUP_START;i<ID_CUP_START+1000;i++) for(i=ID_CUP_START;i<ID_CUP_START+1000;i++)

View File

@ -10,7 +10,7 @@ void
free_memory(void) free_memory(void)
{ {
free_variables(); free_variables();
free_country(); free_country(FALSE);
free_users(FALSE); free_users(FALSE);
free_live_game(&live_game_temp); free_live_game(&live_game_temp);
free_support_dirs(); free_support_dirs();
@ -128,18 +128,22 @@ free_live_game(LiveGame *match)
Free the main variable of the game, #country. Free the main variable of the game, #country.
*/ */
void void
free_country(void) free_country(gboolean reset)
{ {
gint i; gint i;
GString **strings[3] = GString **strings[3] =
{&country.name, &country.symbol, &country.sid}; {&country.name, &country.symbol, &country.sid};
for(i=0;i<3;i++) for(i=0;i<3;i++)
{
free_g_string(strings[i]); free_g_string(strings[i]);
if(reset)
*strings[i] = g_string_new("");
}
free_leagues_array(&ligs, FALSE); free_leagues_array(&ligs, reset);
free_cups_array(&cps, FALSE); free_cups_array(&cps, reset);
} }
/** /**

View File

@ -28,7 +28,7 @@ void
free_user(User *user); free_user(User *user);
void void
free_country(void); free_country(gboolean reset);
void void
free_leagues_array(GArray **leagues, gboolean reset); free_leagues_array(GArray **leagues, gboolean reset);

View File

@ -236,7 +236,8 @@ transfer_add_new_players(void)
for(i=0;i<number_of_new;i++) for(i=0;i<number_of_new;i++)
transfer_add_player(transfer_player_get_new( transfer_add_player(transfer_player_get_new(
(math_rnd(0, 1) < const_float("float_transfer_cup_percentage"))), (math_rnd(0, 1) < const_float("float_transfer_cup_percentage") &&
cps->len > 0)),
math_rndi(const_int("int_transfer_time_lower"), math_rndi(const_int("int_transfer_time_lower"),
const_int("int_transfer_time_upper"))); const_int("int_transfer_time_upper")));
} }

View File

@ -180,7 +180,7 @@ xml_country_read(const gchar *country_name)
strcpy(buf, file_name); strcpy(buf, file_name);
g_free(file_name); g_free(file_name);
free_country(); free_country(TRUE);
if(g_markup_parse_context_parse(context, file_contents, length, &error)) if(g_markup_parse_context_parse(context, file_contents, length, &error))
{ {