1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2024-12-16 10:21:15 +01:00

Options gui.

This commit is contained in:
gyboth 2005-03-24 07:42:24 +00:00
parent a7ceaac784
commit e69adf6c4a
5 changed files with 24 additions and 14 deletions

View File

@ -255,8 +255,7 @@ file_load_opt_file(FILE *fil, OptionList *optionlist)
gchar opt_name[SMALL], opt_value[SMALL];
Option new;
free_option_array(&optionlist->list, TRUE);
g_datalist_init(&optionlist->datalist);
free_option_list(optionlist, TRUE);
while(file_get_next_opt_line(fil, opt_name, opt_value))
{

View File

@ -40,7 +40,7 @@ free_user(User *user)
free_g_string(&user->name);
free_g_string(&user->font_name);
free_live_game(&user->live_game);
free_option_array(&user->options.list, FALSE);
free_option_list(&user->options, FALSE);
for(i=0;i<user->events->len;i++)
free_event(&g_array_index(user->events, Event, i));
@ -60,28 +60,34 @@ free_event(Event *event)
@param reset Whether to create the array anew (empty).
@see #Option */
void
free_option_array(GArray **array, gboolean reset)
free_option_list(OptionList *optionlist, gboolean reset)
{
gint i;
if(*array == NULL)
if(optionlist->list == NULL)
{
if(reset)
*array = g_array_new(FALSE, FALSE, sizeof(Option));
{
optionlist->list = g_array_new(FALSE, FALSE, sizeof(Option));
g_datalist_init(&optionlist->datalist);
}
return;
}
for(i=0;i<(*array)->len;i++)
for(i=0;i<optionlist->list->len;i++)
{
free_g_string(&g_array_index(*array, Option, i).name);
free_g_string(&g_array_index(*array, Option, i).string_value);
free_g_string(&g_array_index(optionlist->list, Option, i).name);
free_g_string(&g_array_index(optionlist->list, Option, i).string_value);
}
free_g_array(array);
free_g_array(&optionlist->list);
if(reset)
*array = g_array_new(FALSE, FALSE, sizeof(Option));
{
optionlist->list = g_array_new(FALSE, FALSE, sizeof(Option));
g_datalist_init(&optionlist->datalist);
}
}
/** Free a live game variable. */
@ -323,8 +329,8 @@ free_variables(void)
free_g_array(&transfer_list);
free_option_array(&options.list, FALSE);
free_option_array(&constants.list, FALSE);
free_option_list(&options, FALSE);
free_option_list(&constants, FALSE);
}
/**

View File

@ -67,7 +67,7 @@ void
free_live_game(LiveGame *match);
void
free_option_array(GArray **array, gboolean reset);
free_option_list(OptionList *optionlist, gboolean reset);
void
free_event(Event *event);

View File

@ -32,6 +32,9 @@ main_init_variables(void)
users = g_array_new(FALSE, FALSE, sizeof(User));
transfer_list = g_array_new(FALSE, FALSE, sizeof(Transfer));
constants.list = options.list = NULL;
constants.datalist = options.datalist = NULL;
popups_active = 0;
selected_row[0] = selected_row[1] = -1;

View File

@ -28,6 +28,8 @@ user_new(void)
new.live_game.stats.players[i][1] = NULL;
new.events = g_array_new(FALSE, FALSE, sizeof(Event));
new.options.list = NULL;
new.options.datalist = NULL;
return new;
}