mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-02-06 02:33:30 +01:00
Options gui.
This commit is contained in:
parent
7a8e898f7b
commit
d0c1b5142a
83
Makefile.am
83
Makefile.am
@ -1,55 +1,42 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
AM_CFLAGS = -Wall
|
||||
|
||||
INCLUDES = \
|
||||
-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
|
||||
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
|
||||
@PACKAGE_CFLAGS@
|
||||
SUBDIRS = src po
|
||||
|
||||
bin_PROGRAMS = bygfoot
|
||||
bin_SCRIPTS = bygfoot-update
|
||||
|
||||
bygfoot_SOURCES = \
|
||||
callback_func.c callback_func.h callbacks.h cup.h finance.h fixture.h game_gui.h league.h live_game.h misc.h option.h player.h start_end.h team.h transfer.h treeview.h user.h window.h \
|
||||
callbacks.c callbacks.h callback_func.h game_gui.h main.h team.h transfer.h treeview.h user.h window.h \
|
||||
cup.c cup.h free.h main.h maths.h misc.h team.h variables.h xml_league.h \
|
||||
file.c file.h free.h main.h misc.h option.h support.h variables.h \
|
||||
finance.c callbacks.h finance.h game_gui.h maths.h option.h player.h team.h user.h \
|
||||
fixture.c cup.h fixture.h free.h league.h main.h maths.h misc.h table.h team.h variables.h \
|
||||
free.c free.h user.h variables.h \
|
||||
game.c cup.h finance.h fixture.h game.h game_gui.h league.h live_game.h maths.h misc.h option.h player.h table.h team.h treeview.h user.h variables.h \
|
||||
game_gui.c file.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h treeview.h support.h team.h user.h variables.h window.h \
|
||||
gui.c gui.h misc.h support.h variables.h window.h \
|
||||
interface.c callbacks.h interface.h support.h \
|
||||
league.c cup.h league.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 \
|
||||
load_save.c load_save.h \
|
||||
main.c misc_callbacks.h file.h free.h main.h transfer_struct.h variables.h window.h \
|
||||
maths.c maths.h misc.h \
|
||||
misc.c main.h maths.h misc.h \
|
||||
misc_callbacks.c free.h misc_callback_func.h misc_callbacks.h \
|
||||
misc_callback_func.c misc_callback_func.h start_end.h support.h team.h treeview.h user.h variables.h xml_country.h \
|
||||
misc_interface.c misc_interface.h misc_callbacks.h support.h \
|
||||
misc2_callbacks.c finance.h game_gui.h main.h misc2_callbacks.h misc2_callback_func.h misc2_interface.h support.h transfer.h user.h window.h \
|
||||
misc2_callback_func.c finance.h game_gui.h maths.h misc2_callback_func.h option.h player.h team.h treeview.h transfer.h user.h \
|
||||
misc2_interface.c misc2_interface.h misc2_callbacks.h support.h \
|
||||
option.c option.h variables.h \
|
||||
option_gui.c option_gui.h option.h variables.h support.h \
|
||||
options_callbacks.c options_callbacks.h \
|
||||
options_interface.c options_interface.h options_callbacks.h support.h \
|
||||
player.c cup.h free.h game_gui.h league.h maths.h misc.h option.h player.h team.h user.h \
|
||||
start_end.c cup.h file.h finance.h fixture.h game_gui.h gui.h league.h live_game.h main.h maths.h start_end.h table.h team.h transfer.h user.h variables.h xml_name.h \
|
||||
support.c support.h \
|
||||
table.c cup.h league.h table.h variables.h \
|
||||
team.c cup.h fixture.h game.h game_gui.h league.h maths.h misc.h option.h player.h team.h transfer.h user.h \
|
||||
transfer.c finance.h free.h maths.h option.h player.h team.h transfer.h user.h \
|
||||
treeview.c cup.h file.h finance.h fixture.h free.h league.h live_game.h maths.h misc.h player.h option.h support.h team.h transfer.h treeview.h treeview_cell.h user.h \
|
||||
treeview_cell.c misc.h option.h player.h team.h treeview.h treeview_cell.h user.h variables.h \
|
||||
user.c fixture.h free.h game_gui.h maths.h misc.h option.h player.h transfer.h user.h window.h \
|
||||
window.c file.h finance.h free.h game_gui.h gui.h interface.h misc_interface.h misc2_interface.h option.h support.h user.h window.h \
|
||||
xml_cup.c cup.h file.h misc.h xml_cup.h \
|
||||
xml_country.c file.h free.h misc.h variables.h xml_cup.h xml_country.h xml_league.h \
|
||||
xml_league.c cup_struct.h file.h free.h league.h misc.h team.h table.h variables.h xml_league.h xml_cup.h \
|
||||
xml_name.c file.h free.h maths.h misc.h variables.h xml_name.h
|
||||
EXTRA_DIST = \
|
||||
autogen.sh \
|
||||
bygfoot.glade \
|
||||
bygfoot.gladep
|
||||
|
||||
bygfoot_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)
|
||||
dist_man6_MANS = man/bygfoot.6
|
||||
|
||||
SUPPORT_DIRS = support_files support_files/names support_files/pixmaps support_files/pixmaps/live_game support_files/definitions
|
||||
|
||||
SUPPORT_FILES = support_files/names/player_names.xml support_files/bygfoot.conf support_files/pixmaps/flag_ro.png support_files/pixmaps/bygfoot_team_editor_icon.png support_files/pixmaps/bygfoot_icon.png support_files/pixmaps/pay_loan.png support_files/pixmaps/inc_cap.png support_files/pixmaps/new_week.png support_files/pixmaps/preview.png support_files/pixmaps/get_loan.png support_files/pixmaps/transfers.png support_files/pixmaps/fire_player.png support_files/pixmaps/inc_saf.png support_files/pixmaps/football.png support_files/pixmaps/flag_br.png support_files/pixmaps/flag_de.png support_files/pixmaps/fin_stad.png support_files/pixmaps/flag_en.png support_files/pixmaps/flag_es.png support_files/pixmaps/flag_fr.png support_files/pixmaps/possession_ball.png support_files/pixmaps/flag_hu.png support_files/pixmaps/live_game/yellow.png support_files/pixmaps/live_game/red.png support_files/pixmaps/live_game/save.png support_files/pixmaps/live_game/goal.png support_files/pixmaps/flag_it.png support_files/pixmaps/flag_mx.png support_files/pixmaps/flag_pl.png support_files/definitions/league_turkey1_short.xml support_files/definitions/league_italy1_short.xml support_files/definitions/league_germany1_short.xml support_files/definitions/country_england.xml support_files/definitions/league_russia1_short.xml support_files/definitions/league_scotland1_short.xml support_files/definitions/league_england1.xml support_files/definitions/league_england2.xml support_files/definitions/league_england3.xml support_files/definitions/league_england4.xml support_files/definitions/league_england5.xml support_files/definitions/league_greece1_short.xml support_files/definitions/league_denmark1_short.xml support_files/definitions/cup_england_fa.xml support_files/definitions/cup_champ_league.xml support_files/definitions/league_ukraine1_short.xml support_files/definitions/league_switzerland1_short.xml support_files/definitions/cup_cwc.xml support_files/definitions/league_netherlands1_short.xml support_files/definitions/league_europe_div.xml support_files/definitions/league_czech1_short.xml support_files/definitions/cup_england_prom_games.xml support_files/definitions/league_portugal1_short.xml support_files/definitions/league_spain1_short.xml support_files/definitions/cup_uefa.xml support_files/definitions/cup_england_league.xml support_files/definitions/league_belgium1_short.xml support_files/definitions/league_france1_short.xml
|
||||
|
||||
install-data-local:
|
||||
@$(NORMAL_INSTALL)
|
||||
for dir in $(SUPPORT_DIRS); do $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/$$dir; done
|
||||
for file in $(SUPPORT_FILES); do $(INSTALL_DATA) $$file $(DESTDIR)$(pkgdatadir)/$$file; done
|
||||
|
||||
dist-hook:
|
||||
for dir in $(SUPPORT_DIRS); do mkdir $(distdir)/$$dir; done
|
||||
for file in $(SUPPORT_FILES); do cp -p $$file $(distdir)/$$file; done
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(pkgdatadir)
|
||||
rm -rf $(prefix)/bin/bygfoot*
|
||||
rm -rf $(prefix)/man/man6/bygfoot.6
|
||||
for dir in $(prefix)/share/locale/*; do rm -rf $$dir/LC_MESSAGES/bygfoot*; done
|
||||
|
||||
doc:
|
||||
doxygen Doxyfile 1> /dev/null
|
||||
|
||||
doc-verbose:
|
||||
doxygen Doxyfile
|
||||
|
||||
doc-clean:
|
||||
rm -rf docs/*
|
||||
|
@ -33,6 +33,7 @@ bygfoot_SOURCES = \
|
||||
misc2_callback_func.c finance.h game_gui.h maths.h misc2_callback_func.h option.h player.h team.h treeview.h transfer.h user.h \
|
||||
misc2_interface.c misc2_interface.h misc2_callbacks.h support.h \
|
||||
option.c option.h variables.h \
|
||||
option_gui.c option_gui.h option.h variables.h support.h \
|
||||
options_callbacks.c options_callbacks.h \
|
||||
options_interface.c options_interface.h options_callbacks.h support.h \
|
||||
player.c cup.h free.h game_gui.h league.h maths.h misc.h option.h player.h team.h user.h \
|
||||
|
@ -94,7 +94,8 @@ typedef struct
|
||||
*digits,
|
||||
*stadium,
|
||||
*job_offer,
|
||||
*yesno;
|
||||
*yesno,
|
||||
*options;
|
||||
} Windows;
|
||||
|
||||
/** A struct representing an option or a constant. */
|
||||
|
@ -33,7 +33,7 @@ callback_show_next_live_game(void)
|
||||
fixture_user_team_involved(&g_array_index(lig(i).fixtures, Fixture, j)) != -1 &&
|
||||
g_array_index(lig(i).fixtures, Fixture, j).attendance == -1 &&
|
||||
option_int("int_opt_user_show_live_game",
|
||||
usr(fixture_user_team_involved(&g_array_index(lig(i).fixtures, Fixture, j))).
|
||||
&usr(fixture_user_team_involved(&g_array_index(lig(i).fixtures, Fixture, j))).
|
||||
options))
|
||||
{
|
||||
live_game_calculate_fixture(&g_array_index(lig(i).fixtures, Fixture, j));
|
||||
@ -49,7 +49,7 @@ callback_show_next_live_game(void)
|
||||
fixture_user_team_involved(&g_array_index(cp(i).fixtures, Fixture, j)) != -1 &&
|
||||
g_array_index(cp(i).fixtures, Fixture, j).attendance == -1 &&
|
||||
option_int("int_opt_user_show_live_game",
|
||||
usr(fixture_user_team_involved(&g_array_index(cp(i).fixtures, Fixture, j))).
|
||||
&usr(fixture_user_team_involved(&g_array_index(cp(i).fixtures, Fixture, j))).
|
||||
options))
|
||||
{
|
||||
live_game_calculate_fixture(&g_array_index(cp(i).fixtures, Fixture, j));
|
||||
|
@ -234,7 +234,7 @@ void
|
||||
on_menu_preferences_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
window_show_options();
|
||||
}
|
||||
|
||||
|
||||
|
12
src/file.c
12
src/file.c
@ -249,12 +249,14 @@ file_get_next_opt_line(FILE *fil, gchar *opt_name, gchar *opt_value)
|
||||
/** Load a file containing name - value pairs into
|
||||
the specified array. */
|
||||
void
|
||||
file_load_opt_file(FILE *fil, GArray **option_array)
|
||||
file_load_opt_file(FILE *fil, OptionList *optionlist)
|
||||
{
|
||||
gint i;
|
||||
gchar opt_name[SMALL], opt_value[SMALL];
|
||||
Option new;
|
||||
|
||||
free_option_array(option_array, TRUE);
|
||||
free_option_array(&optionlist->list, TRUE);
|
||||
g_datalist_init(&optionlist->datalist);
|
||||
|
||||
while(file_get_next_opt_line(fil, opt_name, opt_value))
|
||||
{
|
||||
@ -270,9 +272,13 @@ file_load_opt_file(FILE *fil, GArray **option_array)
|
||||
sscanf(opt_value, "%d", &new.value);
|
||||
}
|
||||
|
||||
g_array_append_val(*option_array, new);
|
||||
g_array_append_val(optionlist->list, new);
|
||||
}
|
||||
|
||||
for(i=0;i<optionlist->list->len;i++)
|
||||
g_datalist_set_data(&optionlist->datalist, g_array_index(optionlist->list, Option, i).name->str,
|
||||
&g_array_index(optionlist->list, Option, i));
|
||||
|
||||
fclose(fil);
|
||||
}
|
||||
|
||||
|
@ -251,6 +251,7 @@ fixture_winner_of(const Fixture *fix)
|
||||
|
||||
first_leg = fixture_get_first_leg(fix);
|
||||
|
||||
/*d*/
|
||||
printf("win_of %s %d - %d %s\n",
|
||||
fix->teams[0]->name->str, fix->result[0][0],
|
||||
fix->result[1][0],
|
||||
@ -921,3 +922,38 @@ fixture_get_latest(const Team *tm)
|
||||
|
||||
return latest;
|
||||
}
|
||||
|
||||
/** Return a pointer array with all the matches featuring the two teams. */
|
||||
GPtrArray*
|
||||
fixture_get_matches(const Team *tm1, const Team *tm2)
|
||||
{
|
||||
gint i, j;
|
||||
GPtrArray *matches = g_ptr_array_new();
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(lig(i).id == tm1->clid)
|
||||
for(j=0;j<lig(i).fixtures->len;j++)
|
||||
{
|
||||
if(g_array_index(lig(i).fixtures, Fixture, j).attendance == -1)
|
||||
break;
|
||||
else if((g_array_index(lig(i).fixtures, Fixture, j).teams[0] == tm1 &&
|
||||
g_array_index(lig(i).fixtures, Fixture, j).teams[1] == tm2) ||
|
||||
(g_array_index(lig(i).fixtures, Fixture, j).teams[0] == tm2 &&
|
||||
g_array_index(lig(i).fixtures, Fixture, j).teams[1] == tm1))
|
||||
g_ptr_array_add(matches, &g_array_index(lig(i).fixtures, Fixture, j));
|
||||
}
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
for(j=0;j<cp(i).fixtures->len;j++)
|
||||
{
|
||||
if(g_array_index(cp(i).fixtures, Fixture, j).attendance == -1)
|
||||
break;
|
||||
else if((g_array_index(cp(i).fixtures, Fixture, j).teams[0] == tm1 &&
|
||||
g_array_index(cp(i).fixtures, Fixture, j).teams[1] == tm2) ||
|
||||
(g_array_index(cp(i).fixtures, Fixture, j).teams[0] == tm2 &&
|
||||
g_array_index(cp(i).fixtures, Fixture, j).teams[1] == tm1))
|
||||
g_ptr_array_add(matches, &g_array_index(cp(i).fixtures, Fixture, j));
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
@ -100,4 +100,7 @@ fixture_get_latest(const Team *tm);
|
||||
gint
|
||||
fixture_compare_func(gconstpointer a, gconstpointer b, gpointer data);
|
||||
|
||||
GPtrArray*
|
||||
fixture_get_matches(const Team *tm1, const Team *tm2);
|
||||
|
||||
#endif
|
||||
|
@ -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, FALSE);
|
||||
free_option_array(&user->options.list, FALSE);
|
||||
|
||||
for(i=0;i<user->events->len;i++)
|
||||
free_event(&g_array_index(user->events, Event, i));
|
||||
@ -323,8 +323,8 @@ free_variables(void)
|
||||
|
||||
free_g_array(&transfer_list);
|
||||
|
||||
free_option_array(&options, FALSE);
|
||||
free_option_array(&constants, FALSE);
|
||||
free_option_array(&options.list, FALSE);
|
||||
free_option_array(&constants.list, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ game_gui_live_game_show_unit(const LiveGameUnit *unit)
|
||||
gtk_progress_bar_set_fraction(progress_bar, (fraction > 1) ? 1 : fraction);
|
||||
gtk_progress_bar_set_text(progress_bar, buf);
|
||||
usleep(500500 + option_int("int_opt_user_live_game_speed",
|
||||
usr(stat2).options) * 50000);
|
||||
&usr(stat2).options) * 50000);
|
||||
while(gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
|
||||
|
@ -42,15 +42,15 @@ create_main_window (void)
|
||||
GtkWidget *trennlinie1;
|
||||
GtkWidget *separatormenuitem1;
|
||||
GtkWidget *start_editor;
|
||||
GtkWidget *image227;
|
||||
GtkWidget *image232;
|
||||
GtkWidget *start_update;
|
||||
GtkWidget *image228;
|
||||
GtkWidget *image233;
|
||||
GtkWidget *trennlinie2;
|
||||
GtkWidget *menu_quit;
|
||||
GtkWidget *menu_options;
|
||||
GtkWidget *menu_options_menu;
|
||||
GtkWidget *menu_preferences;
|
||||
GtkWidget *image229;
|
||||
GtkWidget *image234;
|
||||
GtkWidget *trennlinie7;
|
||||
GtkWidget *menu_notify;
|
||||
GtkWidget *menu_job_offers;
|
||||
@ -109,11 +109,11 @@ create_main_window (void)
|
||||
GtkWidget *menu_user_show_last_stats;
|
||||
GtkWidget *trennlinie9;
|
||||
GtkWidget *menu_next_user;
|
||||
GtkWidget *image230;
|
||||
GtkWidget *image235;
|
||||
GtkWidget *menu_previous_user;
|
||||
GtkWidget *image231;
|
||||
GtkWidget *image236;
|
||||
GtkWidget *menu_manage_users;
|
||||
GtkWidget *image232;
|
||||
GtkWidget *image237;
|
||||
GtkWidget *menu_finances_stadium;
|
||||
GtkWidget *menu_finances_stadium_menu;
|
||||
GtkWidget *menu_show_finances;
|
||||
@ -247,12 +247,12 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_save_as);
|
||||
gtk_container_add (GTK_CONTAINER (menu_file_menu), menu_save_as);
|
||||
|
||||
trennlinie1 = gtk_separator_menu_item_new ();
|
||||
trennlinie1 = gtk_menu_item_new ();
|
||||
gtk_widget_show (trennlinie1);
|
||||
gtk_container_add (GTK_CONTAINER (menu_file_menu), trennlinie1);
|
||||
gtk_widget_set_sensitive (trennlinie1, FALSE);
|
||||
|
||||
separatormenuitem1 = gtk_separator_menu_item_new ();
|
||||
separatormenuitem1 = gtk_menu_item_new ();
|
||||
gtk_widget_show (separatormenuitem1);
|
||||
gtk_container_add (GTK_CONTAINER (menu_file_menu), separatormenuitem1);
|
||||
gtk_widget_set_sensitive (separatormenuitem1, FALSE);
|
||||
@ -261,19 +261,19 @@ create_main_window (void)
|
||||
gtk_widget_show (start_editor);
|
||||
gtk_container_add (GTK_CONTAINER (menu_file_menu), start_editor);
|
||||
|
||||
image227 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image227);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (start_editor), image227);
|
||||
image232 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image232);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (start_editor), image232);
|
||||
|
||||
start_update = gtk_image_menu_item_new_with_mnemonic (_("Start Bygfoot Online Update"));
|
||||
gtk_widget_show (start_update);
|
||||
gtk_container_add (GTK_CONTAINER (menu_file_menu), start_update);
|
||||
|
||||
image228 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image228);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (start_update), image228);
|
||||
image233 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image233);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (start_update), image233);
|
||||
|
||||
trennlinie2 = gtk_separator_menu_item_new ();
|
||||
trennlinie2 = gtk_menu_item_new ();
|
||||
gtk_widget_show (trennlinie2);
|
||||
gtk_container_add (GTK_CONTAINER (menu_file_menu), trennlinie2);
|
||||
gtk_widget_set_sensitive (trennlinie2, FALSE);
|
||||
@ -292,12 +292,15 @@ create_main_window (void)
|
||||
menu_preferences = gtk_image_menu_item_new_with_mnemonic (_("Preferences"));
|
||||
gtk_widget_show (menu_preferences);
|
||||
gtk_container_add (GTK_CONTAINER (menu_options_menu), menu_preferences);
|
||||
gtk_widget_add_accelerator (menu_preferences, "activate", accel_group,
|
||||
GDK_p, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image229 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image229);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image229);
|
||||
image234 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image234);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image234);
|
||||
|
||||
trennlinie7 = gtk_separator_menu_item_new ();
|
||||
trennlinie7 = gtk_menu_item_new ();
|
||||
gtk_widget_show (trennlinie7);
|
||||
gtk_container_add (GTK_CONTAINER (menu_options_menu), trennlinie7);
|
||||
gtk_widget_set_sensitive (trennlinie7, FALSE);
|
||||
@ -486,7 +489,7 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_custom_structure);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_custom_structure);
|
||||
|
||||
trennlinie8 = gtk_separator_menu_item_new ();
|
||||
trennlinie8 = gtk_menu_item_new ();
|
||||
gtk_widget_show (trennlinie8);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), trennlinie8);
|
||||
gtk_widget_set_sensitive (trennlinie8, FALSE);
|
||||
@ -540,7 +543,7 @@ create_main_window (void)
|
||||
GDK_F2, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
trennlinie9 = gtk_separator_menu_item_new ();
|
||||
trennlinie9 = gtk_menu_item_new ();
|
||||
gtk_widget_show (trennlinie9);
|
||||
gtk_container_add (GTK_CONTAINER (menu_user_menu), trennlinie9);
|
||||
gtk_widget_set_sensitive (trennlinie9, FALSE);
|
||||
@ -552,9 +555,9 @@ create_main_window (void)
|
||||
GDK_F9, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image230 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image230);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image230);
|
||||
image235 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image235);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image235);
|
||||
|
||||
menu_previous_user = gtk_image_menu_item_new_with_mnemonic (_("Previous user"));
|
||||
gtk_widget_show (menu_previous_user);
|
||||
@ -563,9 +566,9 @@ create_main_window (void)
|
||||
GDK_F8, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image231 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image231);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image231);
|
||||
image236 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image236);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image236);
|
||||
|
||||
menu_manage_users = gtk_image_menu_item_new_with_mnemonic (_("Manage users"));
|
||||
gtk_widget_show (menu_manage_users);
|
||||
@ -574,9 +577,9 @@ create_main_window (void)
|
||||
GDK_F12, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image232 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image232);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image232);
|
||||
image237 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image237);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image237);
|
||||
|
||||
menu_finances_stadium = gtk_menu_item_new_with_mnemonic (_("FinStad"));
|
||||
gtk_widget_show (menu_finances_stadium);
|
||||
@ -766,32 +769,39 @@ create_main_window (void)
|
||||
label_user = gtk_label_new (_("user"));
|
||||
gtk_widget_show (label_user);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label_user, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label_user), GTK_JUSTIFY_LEFT);
|
||||
|
||||
label23 = gtk_label_new (_(" Season "));
|
||||
gtk_widget_show (label23);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label23, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label23), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_padding (GTK_MISC (label23), 5, 0);
|
||||
|
||||
label_season = gtk_label_new (_("1"));
|
||||
gtk_widget_show (label_season);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label_season, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label_season), GTK_JUSTIFY_LEFT);
|
||||
|
||||
label25 = gtk_label_new (_(" Week "));
|
||||
gtk_widget_show (label25);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label25, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label25), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_padding (GTK_MISC (label25), 5, 0);
|
||||
|
||||
label_week = gtk_label_new (_("1"));
|
||||
gtk_widget_show (label_week);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label_week, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label_week), GTK_JUSTIFY_LEFT);
|
||||
|
||||
label13114 = gtk_label_new (_(" Round "));
|
||||
gtk_widget_show (label13114);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label13114, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label13114), GTK_JUSTIFY_LEFT);
|
||||
|
||||
label_round = gtk_label_new (_("1"));
|
||||
gtk_widget_show (label_round);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label_round, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label_round), GTK_JUSTIFY_LEFT);
|
||||
|
||||
vseparator14 = gtk_vseparator_new ();
|
||||
gtk_widget_show (vseparator14);
|
||||
@ -827,11 +837,13 @@ create_main_window (void)
|
||||
label_team = gtk_label_new (_("Arsenal"));
|
||||
gtk_widget_show (label_team);
|
||||
gtk_container_add (GTK_CONTAINER (eventbox_team_name), label_team);
|
||||
gtk_label_set_justify (GTK_LABEL (label_team), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_padding (GTK_MISC (label_team), 5, 0);
|
||||
|
||||
label_league = gtk_label_new (_("Premier Division"));
|
||||
gtk_widget_show (label_league);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label_league, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label_league), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_padding (GTK_MISC (label_league), 5, 0);
|
||||
|
||||
eventbox_rank = gtk_event_box_new ();
|
||||
@ -845,11 +857,13 @@ create_main_window (void)
|
||||
label29 = gtk_label_new (_("Rank "));
|
||||
gtk_widget_show (label29);
|
||||
gtk_box_pack_start (GTK_BOX (hbox49), label29, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label29), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_padding (GTK_MISC (label29), 5, 0);
|
||||
|
||||
label_rank = gtk_label_new (_("1"));
|
||||
gtk_widget_show (label_rank);
|
||||
gtk_box_pack_start (GTK_BOX (hbox49), label_rank, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label_rank), GTK_JUSTIFY_LEFT);
|
||||
|
||||
vseparator15 = gtk_vseparator_new ();
|
||||
gtk_widget_show (vseparator15);
|
||||
@ -859,11 +873,13 @@ create_main_window (void)
|
||||
label34 = gtk_label_new (_("Money "));
|
||||
gtk_widget_show (label34);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label34, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label34), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_padding (GTK_MISC (label34), 5, 0);
|
||||
|
||||
label_money = gtk_label_new (_("2000"));
|
||||
gtk_widget_show (label_money);
|
||||
gtk_box_pack_start (GTK_BOX (hbox18), label_money, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label_money), GTK_JUSTIFY_LEFT);
|
||||
|
||||
vseparator17 = gtk_vseparator_new ();
|
||||
gtk_widget_show (vseparator17);
|
||||
@ -882,10 +898,12 @@ create_main_window (void)
|
||||
label69 = gtk_label_new (_("Av. skills: "));
|
||||
gtk_widget_show (label69);
|
||||
gtk_box_pack_start (GTK_BOX (hbox50), label69, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label69), GTK_JUSTIFY_LEFT);
|
||||
|
||||
label_av_skills = gtk_label_new (_("label70"));
|
||||
gtk_widget_show (label_av_skills);
|
||||
gtk_box_pack_start (GTK_BOX (hbox50), label_av_skills, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label_av_skills), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_padding (GTK_MISC (label_av_skills), 5, 0);
|
||||
|
||||
hbox7 = gtk_hbox_new (FALSE, 0);
|
||||
@ -924,6 +942,7 @@ create_main_window (void)
|
||||
label71 = gtk_label_new (_("Player list 1"));
|
||||
gtk_widget_show (label71);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_player), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_player), 0), label71);
|
||||
gtk_label_set_justify (GTK_LABEL (label71), GTK_JUSTIFY_LEFT);
|
||||
|
||||
player_list2 = gtk_tree_view_new ();
|
||||
gtk_widget_show (player_list2);
|
||||
@ -932,6 +951,7 @@ create_main_window (void)
|
||||
label72 = gtk_label_new (_("Player list 2"));
|
||||
gtk_widget_show (label72);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_player), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_player), 1), label72);
|
||||
gtk_label_set_justify (GTK_LABEL (label72), GTK_JUSTIFY_LEFT);
|
||||
|
||||
vbox8 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox8);
|
||||
@ -1228,15 +1248,15 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie1, "trennlinie1");
|
||||
GLADE_HOOKUP_OBJECT (main_window, separatormenuitem1, "separatormenuitem1");
|
||||
GLADE_HOOKUP_OBJECT (main_window, start_editor, "start_editor");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image227, "image227");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image232, "image232");
|
||||
GLADE_HOOKUP_OBJECT (main_window, start_update, "start_update");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image228, "image228");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image233, "image233");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie2, "trennlinie2");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_quit, "menu_quit");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_options, "menu_options");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_options_menu, "menu_options_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_preferences, "menu_preferences");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image229, "image229");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image234, "image234");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie7, "trennlinie7");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_notify, "menu_notify");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_job_offers, "menu_job_offers");
|
||||
@ -1291,11 +1311,11 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_user_show_last_stats, "menu_user_show_last_stats");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie9, "trennlinie9");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_next_user, "menu_next_user");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image230, "image230");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image235, "image235");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_previous_user, "menu_previous_user");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image231, "image231");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image236, "image236");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_manage_users, "menu_manage_users");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image232, "image232");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image237, "image237");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium, "menu_finances_stadium");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium_menu, "menu_finances_stadium_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_show_finances, "menu_show_finances");
|
||||
|
@ -229,7 +229,7 @@ live_game_evaluate_unit(LiveGameUnit *unit)
|
||||
{
|
||||
live_game_finish_unit();
|
||||
if(type != LIVE_GAME_EVENT_END_MATCH && show &&
|
||||
option_int("int_opt_user_pause_break", usr(fixture_user_team_involved(match->fix)).options))
|
||||
option_int("int_opt_user_pause_break", &usr(fixture_user_team_involved(match->fix)).options))
|
||||
misc_callback_pause_live_game();
|
||||
}
|
||||
else if(type != LIVE_GAME_EVENT_END_MATCH)
|
||||
@ -397,9 +397,9 @@ live_game_event_injury(gint team, gint player, gboolean create_new)
|
||||
if(show &&
|
||||
team_is_user(tm[last_unit.event.values[LIVE_GAME_EVENT_VALUE_TEAM]]) != -1 &&
|
||||
option_int("int_opt_user_pause_injury",
|
||||
usr(team_is_user(tm[last_unit.event.values[LIVE_GAME_EVENT_VALUE_TEAM]])).options) &&
|
||||
&usr(team_is_user(tm[last_unit.event.values[LIVE_GAME_EVENT_VALUE_TEAM]])).options) &&
|
||||
!option_int("int_opt_user_auto_sub",
|
||||
usr(team_is_user(tm[last_unit.event.values[LIVE_GAME_EVENT_VALUE_TEAM]])).options))
|
||||
&usr(team_is_user(tm[last_unit.event.values[LIVE_GAME_EVENT_VALUE_TEAM]])).options))
|
||||
misc_callback_pause_live_game();
|
||||
else if(tm[last_unit.event.values[LIVE_GAME_EVENT_VALUE_TEAM]]->players->len > 11)
|
||||
{
|
||||
@ -568,10 +568,10 @@ live_game_event_penalty(void)
|
||||
|
||||
if(team_is_user(tm[last_unit.possession]) != -1 &&
|
||||
option_int("int_opt_user_penalty_shooter",
|
||||
usr(team_is_user(tm[last_unit.possession])).options) != -1)
|
||||
&usr(team_is_user(tm[last_unit.possession])).options) != -1)
|
||||
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER] =
|
||||
option_int("int_opt_user_penalty_shooter",
|
||||
usr(team_is_user(tm[last_unit.possession])).options);
|
||||
&usr(team_is_user(tm[last_unit.possession])).options);
|
||||
else
|
||||
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER] =
|
||||
game_get_player(tm[last_unit.possession], GAME_PLAYER_TYPE_PENALTY, -1, -1, FALSE);
|
||||
@ -721,10 +721,10 @@ live_game_event_free_kick(void)
|
||||
new.event.commentary = g_string_new("freekick");
|
||||
if(team_is_user(tm[new.possession]) != -1 &&
|
||||
option_int("int_opt_user_penalty_shooter",
|
||||
usr(team_is_user(tm[last_unit.possession])).options) != -1)
|
||||
&usr(team_is_user(tm[last_unit.possession])).options) != -1)
|
||||
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER] =
|
||||
option_int("int_opt_user_penalty_shooter",
|
||||
usr(team_is_user(tm[last_unit.possession])).options);
|
||||
&usr(team_is_user(tm[last_unit.possession])).options);
|
||||
else
|
||||
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER] =
|
||||
game_get_player(tm[new.possession], new.area, 0, -1, TRUE);
|
||||
@ -770,9 +770,9 @@ live_game_event_send_off(gint team, gint player, gboolean second_yellow)
|
||||
{
|
||||
if(show && team_is_user(tm[team]) != -1 &&
|
||||
option_int("int_opt_user_pause_red",
|
||||
usr(team_is_user(tm[team])).options) &&
|
||||
&usr(team_is_user(tm[team])).options) &&
|
||||
!option_int("int_opt_user_auto_sub",
|
||||
usr(team_is_user(tm[team])).options))
|
||||
&usr(team_is_user(tm[team])).options))
|
||||
misc_callback_pause_live_game();
|
||||
else if(tm[team]->players->len > 11)
|
||||
{
|
||||
@ -1151,7 +1151,7 @@ live_game_reset(Fixture *fix)
|
||||
&usr(fixture_user_team_involved(fix)).live_game : &live_game_temp;
|
||||
show = (fixture_user_team_involved(fix) != -1 &&
|
||||
option_int("int_opt_user_show_live_game",
|
||||
usr(fixture_user_team_involved(fix)).options));
|
||||
&usr(fixture_user_team_involved(fix)).options));
|
||||
|
||||
stat2 = fixture_user_team_involved(fix);
|
||||
|
||||
@ -1439,7 +1439,7 @@ live_game_finish_unit(void)
|
||||
game_get_values(match->fix, match->team_values,
|
||||
match->home_advantage);
|
||||
if(stat2 == cur_user && show &&
|
||||
unit->minute % const_int("int_live_game_player_list_refresh") == 0)
|
||||
unit->minute % opt_int("int_opt_live_game_player_list_refresh") == 0)
|
||||
treeview_show_user_player_list(¤t_user);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,6 @@ main_init_variables(void)
|
||||
live_game_temp.units = NULL;
|
||||
|
||||
users = g_array_new(FALSE, FALSE, sizeof(User));
|
||||
options = g_array_new(FALSE, FALSE, sizeof(Option));
|
||||
constants = g_array_new(FALSE, FALSE, sizeof(Option));
|
||||
transfer_list = g_array_new(FALSE, FALSE, sizeof(Transfer));
|
||||
|
||||
popups_active = 0;
|
||||
|
@ -231,7 +231,7 @@ on_spinbutton_speed_value_changed (GtkSpinButton *spinbutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
option_set_int("int_opt_user_live_game_speed",
|
||||
usr(stat2).options, gtk_spin_button_get_value_as_int(spinbutton));
|
||||
&usr(stat2).options, gtk_spin_button_get_value_as_int(spinbutton));
|
||||
}
|
||||
|
||||
|
||||
|
102
src/option.c
102
src/option.c
@ -7,15 +7,28 @@
|
||||
@return The string_value of the option.
|
||||
@see #Option */
|
||||
gchar*
|
||||
option_string(gchar *name, GArray *option_array)
|
||||
option_string(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gint i;
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_string: option named %s not found\n", name);
|
||||
else
|
||||
return ((Option*)element)->string_value->str;
|
||||
|
||||
for(i=0;i<option_array->len;i++)
|
||||
if(strcmp(g_array_index(option_array, Option, i).name->str, name) == 0)
|
||||
return g_array_index(option_array, Option, i).string_value->str;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_warning("option_string: option named %s not found\n", name);
|
||||
/** Return the GString pointer going with the option. */
|
||||
GString*
|
||||
option_string_pointer(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_string: option named %s not found\n", name);
|
||||
else
|
||||
return ((Option*)element)->string_value;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -26,34 +39,46 @@ option_string(gchar *name, GArray *option_array)
|
||||
@return The value of the option.
|
||||
@see #Option */
|
||||
gint
|
||||
option_int(gchar *name, GArray *option_array)
|
||||
option_int(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<option_array->len;i++)
|
||||
if(strcmp(g_array_index(option_array, Option, i).name->str, name) == 0)
|
||||
return g_array_index(option_array, Option, i).value;
|
||||
|
||||
g_warning("option_int: option named %s not found\n", name);
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_int: option named %s not found\n", name);
|
||||
else
|
||||
return ((Option*)element)->value;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Return the address of an options variable. */
|
||||
gint*
|
||||
option_int_pointer(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_int: option named %s not found\n", name);
|
||||
else
|
||||
return &((Option*)element)->value;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Return the int going with the option named 'name'
|
||||
cast to float and divided by 1000.
|
||||
@param name The name of the option.
|
||||
@return The value of the option cast to float and divided by 1000.
|
||||
@see #Option */
|
||||
gfloat
|
||||
option_float(gchar *name, GArray *option_array)
|
||||
option_float(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gint i;
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
for(i=0;i<option_array->len;i++)
|
||||
if(strcmp(g_array_index(option_array, Option, i).name->str, name) == 0)
|
||||
return (gfloat)g_array_index(option_array, Option, i).value / 10000;
|
||||
|
||||
g_warning("option_float: option named %s not found\n", name);
|
||||
if(element == NULL)
|
||||
g_warning("option_float: option named %s not found\n", name);
|
||||
else
|
||||
return (gfloat)((Option*)element)->value / 10000;
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -63,19 +88,14 @@ option_float(gchar *name, GArray *option_array)
|
||||
@param option_array The option array.
|
||||
@param new_value The value we set. */
|
||||
void
|
||||
option_set_string(gchar *name, GArray *option_array, gchar *new_value)
|
||||
option_set_string(const gchar *name, OptionList *optionlist, const gchar *new_value)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<option_array->len;i++)
|
||||
if(strcmp(g_array_index(option_array, Option, i).name->str, name) == 0)
|
||||
{
|
||||
g_string_printf(g_array_index(option_array, Option, i).string_value,
|
||||
"%s", new_value);
|
||||
return;
|
||||
}
|
||||
|
||||
g_warning("option_set_string: option named %s not found\n", name);
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_set_string: option named %s not found\n", name);
|
||||
else
|
||||
g_string_printf(((Option*)element)->string_value, "%s", new_value);
|
||||
}
|
||||
|
||||
/** Change the value of an int option in the array.
|
||||
@ -83,16 +103,12 @@ option_set_string(gchar *name, GArray *option_array, gchar *new_value)
|
||||
@param option_array The option array.
|
||||
@param new_value The value we set. */
|
||||
void
|
||||
option_set_int(gchar *name, GArray *option_array, gint new_value)
|
||||
option_set_int(const gchar *name, OptionList *optionlist, gint new_value)
|
||||
{
|
||||
gint i;
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
for(i=0;i<option_array->len;i++)
|
||||
if(strcmp(g_array_index(option_array, Option, i).name->str, name) == 0)
|
||||
{
|
||||
g_array_index(option_array, Option, i).value = new_value;
|
||||
return;
|
||||
}
|
||||
|
||||
g_warning("option_set_int: option named %s not found\n", name);
|
||||
if(element == NULL)
|
||||
g_warning("option_set_int: option named %s not found\n", name);
|
||||
else
|
||||
((Option*)element)->value = new_value;
|
||||
}
|
||||
|
51
src/option.h
51
src/option.h
@ -3,43 +3,54 @@
|
||||
|
||||
#include <math.h>
|
||||
#include "bygfoot.h"
|
||||
#include "option_struct.h"
|
||||
|
||||
/** Convenience abbrevs. */
|
||||
#define option_set_float(name, option_array, value) option_set_int(name, option_array, (gint)rint(value * 1000))
|
||||
|
||||
#define opt_str(name) option_string(name, options)
|
||||
#define opt_int(name) option_int(name, options)
|
||||
#define opt_float(name) option_float(name, options)
|
||||
#define opt_str(name) option_string(name, &options)
|
||||
#define opt_strp(name) option_string_pointer(name, &options)
|
||||
#define opt_int(name) option_int(name, &options)
|
||||
#define opt_intp(name) option_int_pointer(name, &options)
|
||||
#define opt_float(name) option_float(name, &options)
|
||||
|
||||
#define opt_set_int(name, value) option_set_int(name, options, value)
|
||||
#define opt_set_str(name, value) option_set_string(name, options, value)
|
||||
#define opt_set_float(name, value) option_set_float(name, options, value)
|
||||
#define opt_set_int(name, value) option_set_int(name, &options, value)
|
||||
#define opt_set_str(name, value) option_set_string(name, &options, value)
|
||||
#define opt_set_float(name, value) option_set_float(name, &options, value)
|
||||
|
||||
#define opt_user_str(name) option_string(name, current_user.options)
|
||||
#define opt_user_int(name) option_int(name, current_user.options)
|
||||
#define opt_user_float(name) option_float(name, current_user.options)
|
||||
#define opt_user_str(name) option_string(name, ¤t_user.options)
|
||||
#define opt_user_strp(name) option_string_pointer(name, ¤t_user.options)
|
||||
#define opt_user_int(name) option_int(name, ¤t_user.options)
|
||||
#define opt_user_intp(name) option_int_pointer(name, ¤t_user.options)
|
||||
#define opt_user_float(name) option_float(name, ¤t_user.options)
|
||||
|
||||
#define opt_user_set_int(name, value) option_set_int(name, current_user.options, value)
|
||||
#define opt_user_set_str(name, value) option_set_string(name, current_user.options, value)
|
||||
#define opt_user_set_float(name, value) option_set_float(name, current_user.options, value)
|
||||
#define opt_user_set_int(name, value) option_set_int(name, ¤t_user.options, value)
|
||||
#define opt_user_set_str(name, value) option_set_string(name, ¤t_user.options, value)
|
||||
#define opt_user_set_float(name, value) option_set_float(name, ¤t_user.options, value)
|
||||
|
||||
#define const_str(name) option_string(name, constants)
|
||||
#define const_int(name) option_int(name, constants)
|
||||
#define const_float(name) option_float(name, constants)
|
||||
#define const_str(name) option_string(name, &constants)
|
||||
#define const_int(name) option_int(name, &constants)
|
||||
#define const_float(name) option_float(name, &constants)
|
||||
|
||||
gfloat
|
||||
option_float(gchar *name, GArray *option_array);
|
||||
option_float(const gchar *name, OptionList *optionlist);
|
||||
|
||||
gint
|
||||
option_int(gchar *name, GArray *option_array);
|
||||
option_int(const gchar *name, OptionList *optionlist);
|
||||
|
||||
gint*
|
||||
option_int_pointer(const gchar *name, OptionList *optionlist);
|
||||
|
||||
gchar*
|
||||
option_string(gchar *name, GArray *option_array);
|
||||
option_string(const gchar *name, OptionList *optionlist);
|
||||
|
||||
GString*
|
||||
option_string_pointer(const gchar *name, OptionList *optionlist);
|
||||
|
||||
void
|
||||
option_set_string(gchar *name, GArray *option_array, gchar *new_value);
|
||||
option_set_string(const gchar *name, OptionList *optionlist, const gchar *new_value);
|
||||
|
||||
void
|
||||
option_set_int(gchar *name, GArray *option_array, gint new_value);
|
||||
option_set_int(const gchar *name, OptionList *optionlist, gint new_value);
|
||||
|
||||
#endif
|
||||
|
@ -7,20 +7,11 @@
|
||||
#include "options_callbacks.h"
|
||||
#include "options_interface.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
gboolean
|
||||
on_opt_window_delete_event (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#include "variables.h"
|
||||
#include "window.h"
|
||||
|
||||
void
|
||||
on_check_show_live_toggled (GtkToggleButton *togglebutton,
|
||||
on_button_options_ok_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
@ -28,57 +19,9 @@ on_check_show_live_toggled (GtkToggleButton *togglebutton,
|
||||
|
||||
|
||||
void
|
||||
on_spin_live_duration_activate (GtkEntry *entry,
|
||||
on_button_options_cancel_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_button_opt_change_font_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_checkbutton_autosave_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_checkbutton_sort_transfers_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_checkbutton_notify_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_button_opt_ok_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_button_opt_cancel_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
window_destroy(&window.options, TRUE);
|
||||
}
|
||||
|
||||
|
@ -1,39 +1,9 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
gboolean
|
||||
on_opt_window_delete_event (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
void
|
||||
on_button_options_ok_clicked (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_check_show_live_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_spin_live_duration_activate (GtkEntry *entry,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_button_opt_change_font_clicked (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_checkbutton_autosave_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_checkbutton_sort_transfers_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_checkbutton_notify_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_button_opt_ok_clicked (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_button_opt_cancel_clicked (GtkButton *button,
|
||||
on_button_options_cancel_clicked (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,4 +2,4 @@
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
GtkWidget* create_opt_window (void);
|
||||
GtkWidget* create_window_options (void);
|
||||
|
@ -15,7 +15,6 @@
|
||||
# include <libintl.h>
|
||||
# undef _
|
||||
# define _(String) dgettext (PACKAGE, String)
|
||||
# define Q_(String) g_strip_context ((String), gettext (String))
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
@ -28,7 +27,6 @@
|
||||
# define dcgettext(Domain,Message,Type) (Message)
|
||||
# define bindtextdomain(Domain,Directory) (Domain)
|
||||
# define _(String) (String)
|
||||
# define Q_(String) g_strip_context ((String), (String))
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
|
@ -1327,12 +1327,13 @@ treeview_create_single_table(GtkListStore *liststore, const Table *table, gint n
|
||||
|
||||
gtk_list_store_set(liststore, &iter, 0, symbol, -1);
|
||||
|
||||
/*todo: cup choose team user */
|
||||
treeview_get_table_element_colours(table, i, colour_fg, colour_bg, FALSE);
|
||||
sprintf(buf[0], "<span background='%s' foreground = '%s'>%d</span>",
|
||||
sprintf(buf[0], "<span background='%s' foreground='%s'>%d</span>",
|
||||
colour_bg, colour_fg, i + 1);
|
||||
|
||||
treeview_get_table_element_colours(table, i, colour_fg, colour_bg, TRUE);
|
||||
sprintf(buf[1], "<span background='%s' foreground = '%s'>%s</span>",
|
||||
sprintf(buf[1], "<span background='%s' foreground='%s'>%s</span>",
|
||||
colour_bg, colour_fg, elem->team->name->str);
|
||||
|
||||
for(j=2;j<10;j++)
|
||||
@ -1607,9 +1608,46 @@ treeview_show_transfer_list(GtkTreeView *treeview)
|
||||
void
|
||||
treeview_create_own_results(const Team *tm, gchar *buf)
|
||||
{
|
||||
|
||||
gint i, res[2];
|
||||
gchar buf2[SMALL];
|
||||
GPtrArray *matches = fixture_get_matches(current_user.tm, tm);
|
||||
|
||||
strcpy(buf, "");
|
||||
|
||||
for(i=0;i<matches->len;i++)
|
||||
{
|
||||
res[0] = math_sum_int_array(((Fixture*)g_ptr_array_index(matches, i))->result[0], 2);
|
||||
res[1] = math_sum_int_array(((Fixture*)g_ptr_array_index(matches, i))->result[1], 2);
|
||||
|
||||
if(res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] != current_user.tm] >
|
||||
res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] == current_user.tm])
|
||||
sprintf(buf2, _("W %d : %d"),
|
||||
res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] != current_user.tm],
|
||||
res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] == current_user.tm]);
|
||||
else if(res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] != current_user.tm] <
|
||||
res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] == current_user.tm])
|
||||
sprintf(buf2, _("L %d : %d"),
|
||||
res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] != current_user.tm],
|
||||
res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] == current_user.tm]);
|
||||
else
|
||||
sprintf(buf2, _("D %d : %d"),
|
||||
res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] != current_user.tm],
|
||||
res[((Fixture*)g_ptr_array_index(matches, i))->teams[0] == current_user.tm]);
|
||||
|
||||
if(((Fixture*)g_ptr_array_index(matches, i))->home_advantage)
|
||||
{
|
||||
if(((Fixture*)g_ptr_array_index(matches, i))->teams[0] == current_user.tm)
|
||||
strcat(buf2, _(" (H) "));
|
||||
else
|
||||
strcat(buf2, _(" (A) "));
|
||||
}
|
||||
else
|
||||
strcat(buf2, _(" (N) "));
|
||||
|
||||
strcat(buf, buf2);
|
||||
}
|
||||
|
||||
g_ptr_array_free(matches, TRUE);
|
||||
}
|
||||
|
||||
/** Show a row of WDWWLL type results and the goals for and against.
|
||||
|
@ -27,7 +27,6 @@ user_new(void)
|
||||
new.live_game.stats.players[i][0] =
|
||||
new.live_game.stats.players[i][1] = NULL;
|
||||
|
||||
new.options = g_array_new(FALSE, FALSE, sizeof(Option));
|
||||
new.events = g_array_new(FALSE, FALSE, sizeof(Event));
|
||||
|
||||
return new;
|
||||
@ -139,10 +138,10 @@ user_set_player_list_attributes(const User *user, PlayerListAttribute *attribute
|
||||
|
||||
sprintf(prefix, "int_opt_user_pl%d_att", list_number);
|
||||
|
||||
for(i=0;i<user->options->len;i++)
|
||||
if(g_str_has_prefix(g_array_index(user->options, Option, i).name->str, prefix))
|
||||
for(i=0;i<user->options.list->len;i++)
|
||||
if(g_str_has_prefix(g_array_index(user->options.list, Option, i).name->str, prefix))
|
||||
{
|
||||
attribute->on_off[cnt] = g_array_index(user->options, Option, i).value;
|
||||
attribute->on_off[cnt] = g_array_index(user->options.list, Option, i).value;
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "bygfoot.h"
|
||||
#include "enums.h"
|
||||
#include "live_game_struct.h"
|
||||
#include "option_struct.h"
|
||||
#include "player_struct.h"
|
||||
#include "team_struct.h"
|
||||
|
||||
@ -59,7 +60,7 @@ typedef struct
|
||||
/** The team the user manages. */
|
||||
Team *tm;
|
||||
/** User options. */
|
||||
GArray *options;
|
||||
OptionList options;
|
||||
/** Events shown each week. */
|
||||
GArray *events;
|
||||
/** User counters (not changeable by the user),
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "bygfoot.h"
|
||||
#include "enums.h"
|
||||
#include "live_game_struct.h"
|
||||
#include "option_struct.h"
|
||||
#include "player_struct.h"
|
||||
#include "team_struct.h"
|
||||
#include "user_struct.h"
|
||||
@ -17,10 +18,10 @@ gint season, week, week_round;
|
||||
|
||||
/** Array of options that get read from
|
||||
bygfoot.conf. */
|
||||
GArray *options;
|
||||
/** Array of constants that get read from the constans
|
||||
OptionList options;
|
||||
/** Array of constants that get read from the constants
|
||||
file specified in bygfoot.conf. */
|
||||
GArray *constants;
|
||||
OptionList constants;
|
||||
|
||||
/** The array containing players to be transfered.
|
||||
@see TransferPlayer */
|
||||
|
26
src/window.c
26
src/window.c
@ -7,6 +7,8 @@
|
||||
#include "misc_interface.h"
|
||||
#include "misc2_interface.h"
|
||||
#include "option.h"
|
||||
#include "option_gui.h"
|
||||
#include "options_interface.h"
|
||||
#include "support.h"
|
||||
#include "user.h"
|
||||
#include "window.h"
|
||||
@ -40,6 +42,17 @@ window_show_startup(void)
|
||||
free_g_string_array(&dir_contents);
|
||||
}
|
||||
|
||||
|
||||
/** Show the options window. */
|
||||
void
|
||||
window_show_options(void)
|
||||
{
|
||||
window_create(WINDOW_OPTIONS);
|
||||
|
||||
option_gui_set_up_window();
|
||||
}
|
||||
|
||||
|
||||
/** Show the digits window with the labels and values set
|
||||
according to the arguments. */
|
||||
void
|
||||
@ -210,7 +223,7 @@ window_create(gint window_type)
|
||||
wind = window.live;
|
||||
gtk_spin_button_set_value(
|
||||
GTK_SPIN_BUTTON(lookup_widget(wind, "spinbutton_speed")),
|
||||
(gfloat)option_int("int_opt_user_live_game_speed", usr(stat2).options));
|
||||
(gfloat)option_int("int_opt_user_live_game_speed", &usr(stat2).options));
|
||||
break;
|
||||
case WINDOW_STARTUP_USERS:
|
||||
if(window.startup_users != NULL)
|
||||
@ -283,6 +296,17 @@ window_create(gint window_type)
|
||||
wind = window.yesno;
|
||||
strcpy(buf, "???");
|
||||
break;
|
||||
case WINDOW_OPTIONS:
|
||||
if(window.options != NULL)
|
||||
g_warning("window_create: called on already existing window\n");
|
||||
else
|
||||
{
|
||||
popups_active++;
|
||||
window.options = create_window_options();
|
||||
}
|
||||
wind = window.options;
|
||||
strcpy(buf, "Options");
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(wind), buf);
|
||||
|
@ -17,6 +17,7 @@ enum Windows
|
||||
WINDOW_STADIUM,
|
||||
WINDOW_JOB_OFFER,
|
||||
WINDOW_YESNO,
|
||||
WINDOW_OPTIONS,
|
||||
WINDOW_END
|
||||
};
|
||||
|
||||
@ -38,4 +39,7 @@ window_show_stadium(void);
|
||||
void
|
||||
window_show_yesno(gchar *text, gboolean checkbutton);
|
||||
|
||||
void
|
||||
window_show_options(void);
|
||||
|
||||
#endif
|
||||
|
@ -11,12 +11,13 @@ int_opt_maximize_main_window 1
|
||||
int_opt_prefer_messages 0
|
||||
int_opt_autosave 0
|
||||
int_opt_autosave_interval 3
|
||||
int_opt_compress 1
|
||||
int_opt_objective 1
|
||||
|
||||
# precision of skill and talent in player lists
|
||||
int_opt_player_precision 0
|
||||
|
||||
# refresh rate of the player list during a live game
|
||||
# the smaller the more often the list gets refreshed
|
||||
int_opt_live_game_player_list_refresh 10
|
||||
|
||||
# whether some debugging info's shown (in the console)
|
||||
int_opt_debug 0
|
||||
|
@ -414,10 +414,6 @@ float_player_injury_recovery_fitness_upper 7000
|
||||
float_live_game_temp_injury_fitness_decrease_lower 200
|
||||
float_live_game_temp_injury_fitness_decrease_upper 800
|
||||
|
||||
# refresh rate of the player list during a live game
|
||||
# the smaller the more often the list gets refreshed
|
||||
int_live_game_player_list_refresh 5
|
||||
|
||||
# probability that a scoring chance is an own goal.
|
||||
float_live_game_scoring_chance_is_own_goal 100
|
||||
|
||||
|
@ -8,28 +8,13 @@ int_opt_user_confirm_unfit 1
|
||||
int_opt_user_show_live_game 0
|
||||
int_opt_user_live_game_speed -10
|
||||
int_opt_user_show_tendency_bar 1
|
||||
int_opt_user_notify_transfer 0
|
||||
int_opt_user_notify_pos -1
|
||||
int_opt_user_notify_league_upper -1
|
||||
int_opt_user_notify_league_lower -1
|
||||
int_opt_user_notify_cups 0
|
||||
int_opt_user_notify_age_upper 36
|
||||
int_opt_user_notify_age_lower 18
|
||||
int_opt_user_notify_skill_upper 99
|
||||
int_opt_user_notify_skill_lower 1
|
||||
int_opt_user_notify_etal_upper 99
|
||||
int_opt_user_notify_etal_lower 1
|
||||
int_opt_user_notify_value -1
|
||||
int_opt_user_show_job_offers 1
|
||||
int_opt_user_sort_transfer_list 0
|
||||
int_opt_user_sort_transfer_attribute 1
|
||||
int_opt_user_reaarrange_adapts 1
|
||||
int_opt_user_swap_adapts 1
|
||||
int_opt_user_penalty_shooter -1
|
||||
int_opt_user_pause_injury 1
|
||||
int_opt_user_pause_red 1
|
||||
int_opt_user_pause_break 1
|
||||
int_opt_user_auto_sub 1
|
||||
int_opt_user_show_job_offers 1
|
||||
int_opt_user_reaarrange_adapts 1
|
||||
int_opt_user_swap_adapts 1
|
||||
int_opt_user_show_overall 0
|
||||
|
||||
# the order of these attributes is important
|
||||
|
Loading…
x
Reference in New Issue
Block a user