1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2025-02-09 16:18:44 +01:00

Minor fixes.

This commit is contained in:
gyboth 2005-04-09 19:18:28 +00:00
parent d973da436a
commit b5ccda8879
40 changed files with 431 additions and 180 deletions

View File

@ -55,6 +55,27 @@
</widget> </widget>
</child> </child>
<child>
<widget class="GtkImageMenuItem" id="menu_load_last_save">
<property name="visible">True</property>
<property name="label" translatable="yes">Load last save</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menu_load_last_save_activate" last_modification_time="Sat, 09 Apr 2005 14:53:26 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image277">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child> <child>
<widget class="GtkImageMenuItem" id="menu_save"> <widget class="GtkImageMenuItem" id="menu_save">
<property name="visible">True</property> <property name="visible">True</property>
@ -110,7 +131,7 @@
<accelerator key="p" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="p" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image264"> <widget class="GtkImage" id="image278">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-preferences</property> <property name="stock">gtk-preferences</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -246,7 +267,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">All Out Defend</property> <property name="label" translatable="yes">All Out Defend</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:56 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:56 GMT"/>
</widget> </widget>
</child> </child>
@ -256,7 +277,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Defend</property> <property name="label" translatable="yes">Defend</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<property name="group">menu_all_out_defend</property> <property name="group">menu_all_out_defend</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:07 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:07 GMT"/>
</widget> </widget>
@ -267,7 +288,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Balanced</property> <property name="label" translatable="yes">Balanced</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<property name="group">menu_all_out_defend</property> <property name="group">menu_all_out_defend</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:14 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:14 GMT"/>
</widget> </widget>
@ -278,7 +299,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Attack</property> <property name="label" translatable="yes">Attack</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<property name="group">menu_all_out_defend</property> <property name="group">menu_all_out_defend</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:20 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:20 GMT"/>
</widget> </widget>
@ -313,7 +334,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Best</property> <property name="label" translatable="yes">Best</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:47 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:47 GMT"/>
</widget> </widget>
</child> </child>
@ -323,7 +344,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Good</property> <property name="label" translatable="yes">Good</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<property name="group">menu_scout_best</property> <property name="group">menu_scout_best</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:35 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:35 GMT"/>
</widget> </widget>
@ -334,7 +355,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Average</property> <property name="label" translatable="yes">Average</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<property name="group">menu_scout_best</property> <property name="group">menu_scout_best</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:54 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:54 GMT"/>
</widget> </widget>
@ -369,7 +390,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Best</property> <property name="label" translatable="yes">Best</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:14 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:14 GMT"/>
</widget> </widget>
</child> </child>
@ -379,7 +400,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Good</property> <property name="label" translatable="yes">Good</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<property name="group">menu_physio_best</property> <property name="group">menu_physio_best</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:21 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:21 GMT"/>
</widget> </widget>
@ -390,7 +411,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Average</property> <property name="label" translatable="yes">Average</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<property name="group">menu_physio_best</property> <property name="group">menu_physio_best</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:28 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:28 GMT"/>
</widget> </widget>
@ -425,7 +446,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">On</property> <property name="label" translatable="yes">On</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Tue, 08 Mar 2005 16:37:57 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Tue, 08 Mar 2005 16:37:57 GMT"/>
</widget> </widget>
</child> </child>
@ -435,7 +456,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Off</property> <property name="label" translatable="yes">Off</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="active">True</property> <property name="active">False</property>
<property name="group">menu_boost_on</property> <property name="group">menu_boost_on</property>
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Tue, 08 Mar 2005 16:37:48 GMT"/> <signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Tue, 08 Mar 2005 16:37:48 GMT"/>
</widget> </widget>
@ -456,6 +477,12 @@
</widget> </widget>
</child> </child>
<child>
<widget class="GtkMenuItem" id="trennlinie11">
<property name="visible">True</property>
</widget>
</child>
<child> <child>
<widget class="GtkMenuItem" id="menu_custom_structure"> <widget class="GtkMenuItem" id="menu_custom_structure">
<property name="visible">True</property> <property name="visible">True</property>
@ -465,6 +492,17 @@
</widget> </widget>
</child> </child>
<child>
<widget class="GtkMenuItem" id="menu_rearrange_team">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Try to put the startup players onto their favoured positions and sort the substitutes (Ctrl-R or middle click)</property>
<property name="label" translatable="yes">Rearrange team</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menu_rearrange_team_activate" last_modification_time="Sat, 09 Apr 2005 08:59:08 GMT"/>
<accelerator key="r" modifiers="GDK_CONTROL_MASK" signal="activate"/>
</widget>
</child>
<child> <child>
<widget class="GtkMenuItem" id="trennlinie8"> <widget class="GtkMenuItem" id="trennlinie8">
<property name="visible">True</property> <property name="visible">True</property>
@ -609,7 +647,7 @@
<accelerator key="F9" modifiers="0" signal="activate"/> <accelerator key="F9" modifiers="0" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image265"> <widget class="GtkImage" id="image279">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-go-forward</property> <property name="stock">gtk-go-forward</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -631,7 +669,7 @@
<accelerator key="F8" modifiers="0" signal="activate"/> <accelerator key="F8" modifiers="0" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image266"> <widget class="GtkImage" id="image280">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-go-back</property> <property name="stock">gtk-go-back</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -653,7 +691,7 @@
<accelerator key="F12" modifiers="0" signal="activate"/> <accelerator key="F12" modifiers="0" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image267"> <widget class="GtkImage" id="image281">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-justify-fill</property> <property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -743,11 +781,10 @@
<widget class="GtkButton" id="button_load"> <widget class="GtkButton" id="button_load">
<property name="border_width">2</property> <property name="border_width">2</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Load game (L or Ctrl - O)</property> <property name="tooltip" translatable="yes">Load game (Ctrl - O)</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="on_button_load_clicked" last_modification_time="Fri, 06 Feb 2004 10:20:08 GMT"/> <signal name="clicked" handler="on_button_load_clicked" last_modification_time="Fri, 06 Feb 2004 10:20:08 GMT"/>
<accelerator key="l" modifiers="0" signal="clicked"/>
<child> <child>
<widget class="GtkImage" id="image11"> <widget class="GtkImage" id="image11">
@ -776,7 +813,6 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="on_button_save_clicked" last_modification_time="Fri, 06 Feb 2004 10:20:01 GMT"/> <signal name="clicked" handler="on_button_save_clicked" last_modification_time="Fri, 06 Feb 2004 10:20:01 GMT"/>
<accelerator key="s" modifiers="0" signal="clicked"/>
<child> <child>
<widget class="GtkImage" id="image12"> <widget class="GtkImage" id="image12">

View File

@ -715,7 +715,7 @@
<child> <child>
<widget class="GtkLabel" id="label108"> <widget class="GtkLabel" id="label108">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Resume last game</property> <property name="label" translatable="yes">_Resume last game</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="use_markup">False</property> <property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
@ -1452,6 +1452,7 @@
<property name="modal">False</property> <property name="modal">False</property>
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<signal name="delete_event" handler="on_window_stadium_delete_event" last_modification_time="Sat, 09 Apr 2005 08:49:40 GMT"/>
<child> <child>
<widget class="GtkVBox" id="vbox39"> <widget class="GtkVBox" id="vbox39">

View File

@ -22,7 +22,7 @@ bygfoot_SOURCES = \
interface.c callbacks.h interface.h support.h \ interface.c callbacks.h interface.h support.h \
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 game_gui.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 callbacks.h file.h game_gui.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 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 \ 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 \
@ -33,7 +33,7 @@ bygfoot_SOURCES = \
misc2_callback_func.c file.h finance.h game_gui.h maths.h misc2_callback_func.h option.h player.h support.h team.h treeview.h transfer.h user.h window.h \ misc2_callback_func.c file.h finance.h game_gui.h maths.h misc2_callback_func.h option.h player.h support.h team.h treeview.h transfer.h user.h window.h \
misc2_interface.c misc2_interface.h misc2_callbacks.h support.h \ misc2_interface.c misc2_interface.h misc2_callbacks.h support.h \
option.c option.h variables.h \ option.c option.h variables.h \
option_gui.c file.h option_gui.h option.h support.h user.h variables.h \ option_gui.c file.h callbacks.h option_gui.h option.h support.h user.h variables.h \
options_callbacks.c file.h options_callbacks.h options_interface.h option_gui.h support.h user.h variables.h window.h \ options_callbacks.c file.h options_callbacks.h options_interface.h option_gui.h support.h user.h variables.h window.h \
options_interface.c options_interface.h options_callbacks.h support.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 \ player.c cup.h free.h game_gui.h league.h maths.h misc.h option.h player.h team.h user.h \
@ -45,7 +45,7 @@ bygfoot_SOURCES = \
treeview.c cup.h file.h finance.h fixture.h free.h game.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.c cup.h file.h finance.h fixture.h free.h game.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 cup.h league.h misc.h option.h player.h team.h treeview.h treeview_cell.h user.h variables.h \ treeview_cell.c cup.h league.h 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 live_game.h maths.h misc.h option.h player.h team.h transfer.h treeview.h user.h window.h \ user.c fixture.h free.h game_gui.h live_game.h maths.h misc.h option.h player.h team.h transfer.h treeview.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 \ window.c file.h finance.h free.h game_gui.h gui.h interface.h main.h misc_interface.h misc2_interface.h option.h support.h user.h window.h \
xml.c cup.h file.h free.h gui.h league.h misc.h support.h table.h transfer_struct.h user.h variables.h xml.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_teams.h xml_loadsave_fixtures.h xml_loadsave_table.h xml_loadsave_transfers.h xml_loadsave_users.h \ xml.c cup.h file.h free.h gui.h league.h misc.h support.h table.h transfer_struct.h user.h variables.h xml.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_teams.h xml_loadsave_fixtures.h xml_loadsave_table.h xml_loadsave_transfers.h xml_loadsave_users.h \
xml_loadsave_misc.c file.h misc.h variables.h xml.h xml_loadsave_misc.h xml_loadsave_cup.h xml_loadsave_league.h \ xml_loadsave_misc.c file.h misc.h variables.h xml.h xml_loadsave_misc.h xml_loadsave_cup.h xml_loadsave_league.h \
xml_loadsave_cup.c cup.h file.h misc.h team.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_table.h xml_loadsave_teams.h \ xml_loadsave_cup.c cup.h file.h misc.h team.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_table.h xml_loadsave_teams.h \

View File

@ -58,7 +58,7 @@
enum ExitCodes enum ExitCodes
{ {
EXIT_OK = 0, /**< Normal exit. */ EXIT_OK = 0, /**< Normal exit. */
EXIT_DIR_OPEN_FAILED, /**< Exit when the $HOME/.bygfoot/definitions directory can't be opened. */ EXIT_NO_COUNTRY_FILES, /**< Exit when no country files have been found. */
EXIT_FILE_OPEN_FAILED, /** A file could not be opened. */ EXIT_FILE_OPEN_FAILED, /** A file could not be opened. */
EXIT_PRINT_ERROR, /**< Exit when the print_error function is called on a set error.*/ EXIT_PRINT_ERROR, /**< Exit when the print_error function is called on a set error.*/
EXIT_NO_LEAGUES, /**< The game must contain at least one league. */ EXIT_NO_LEAGUES, /**< The game must contain at least one league. */

View File

@ -130,6 +130,10 @@ callback_show_last_match(void)
window_create(WINDOW_LIVE); window_create(WINDOW_LIVE);
current_user.live_game.fix =
&g_array_index(league_cup_get_fixtures(current_user.live_game.fix_clid),
Fixture, current_user.live_game.fix_idx);
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.live, "treeview_stats")), treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.live, "treeview_stats")),
&current_user.live_game); &current_user.live_game);
live_game_set_match(&current_user.live_game); live_game_set_match(&current_user.live_game);
@ -138,6 +142,18 @@ callback_show_last_match(void)
game_gui_live_game_show_unit(&g_array_index(current_user.live_game.units, LiveGameUnit, i)); game_gui_live_game_show_unit(&g_array_index(current_user.live_game.units, LiveGameUnit, i));
} }
/** Show the last match stats of the current user. */
void
callback_show_last_match_stats(void)
{
current_user.live_game.fix =
&g_array_index(league_cup_get_fixtures(current_user.live_game.fix_clid),
Fixture, current_user.live_game.fix_idx);
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")),
&current_user.live_game);
}
/** Show some fixtures. /** Show some fixtures.
@param type An integer telling us which league/cup and which @param type An integer telling us which league/cup and which
week and round to show. */ week and round to show. */

View File

@ -39,4 +39,7 @@ callback_show_player_list(gint type);
void void
callback_fire_player(gint idx); callback_fire_player(gint idx);
void
callback_show_last_match_stats(void);
#endif #endif

View File

@ -108,6 +108,7 @@ on_button_back_to_main_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
stat0 = STATUS_MAIN; stat0 = STATUS_MAIN;
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(window.main, "notebook_player")), 0);
game_gui_show_main(); game_gui_show_main();
} }
@ -119,6 +120,7 @@ on_button_transfers_clicked (GtkButton *button,
stat0 = STATUS_SHOW_TRANSFER_LIST; stat0 = STATUS_SHOW_TRANSFER_LIST;
game_gui_print_message(_("Left click to make an offer. Right click to remove offer.")); game_gui_print_message(_("Left click to make an offer. Right click to remove offer."));
treeview_show_transfer_list(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right"))); treeview_show_transfer_list(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")));
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(window.main, "notebook_player")), 1);
} }
@ -161,6 +163,12 @@ on_player_list1_button_press_event (GtkWidget *widget,
{ {
gint idx = -1; gint idx = -1;
if(event->button == 2)
{
on_menu_rearrange_team_activate(NULL, NULL);
return TRUE;
}
if(treeview_select_row(GTK_TREE_VIEW(widget), event)) if(treeview_select_row(GTK_TREE_VIEW(widget), event))
idx = treeview_get_index(GTK_TREE_VIEW(widget), 0); idx = treeview_get_index(GTK_TREE_VIEW(widget), 0);
@ -187,6 +195,10 @@ on_button_browse_forward_clicked (GtkButton *button,
case STATUS_BROWSE_TEAMS: case STATUS_BROWSE_TEAMS:
callback_show_team(SHOW_NEXT); callback_show_team(SHOW_NEXT);
break; break;
case STATUS_SHOW_PLAYER_INFO:
selected_row[0] = (selected_row[0] + 1) % current_user.tm->players->len;
on_menu_show_info_activate(NULL, NULL);
break;
} }
} }
@ -202,11 +214,14 @@ on_button_browse_back_clicked (GtkButton *button,
break; break;
case STATUS_BROWSE_TEAMS: case STATUS_BROWSE_TEAMS:
callback_show_team(SHOW_PREVIOUS); callback_show_team(SHOW_PREVIOUS);
break;
case STATUS_SHOW_PLAYER_INFO:
selected_row[0] = (selected_row[0] == 0) ? current_user.tm->players->len - 1 : selected_row[0] - 1;
on_menu_show_info_activate(NULL, NULL);
break;
} }
} }
void void
on_button_cl_back_clicked (GtkButton *button, on_button_cl_back_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
@ -398,6 +413,16 @@ on_treeview_right_button_press_event (GtkWidget *widget,
{ {
gint idx; gint idx;
if(stat0 == STATUS_SHOW_FINANCES)
{
if(event->button == 1)
callback_get_loan();
else if(event->button == 3)
callback_pay_loan();
else if(event->button == 2)
on_menu_show_stadium_activate(NULL, NULL);
}
if(gtk_tree_selection_get_mode( if(gtk_tree_selection_get_mode(
gtk_tree_view_get_selection(GTK_TREE_VIEW(widget))) == gtk_tree_view_get_selection(GTK_TREE_VIEW(widget))) ==
GTK_SELECTION_NONE) GTK_SELECTION_NONE)
@ -410,12 +435,6 @@ on_treeview_right_button_press_event (GtkWidget *widget,
switch(stat0) switch(stat0)
{ {
case STATUS_SHOW_FINANCES:
if(event->button == 1)
callback_get_loan();
else if(event->button == 3)
callback_pay_loan();
break;
case STATUS_SHOW_TRANSFER_LIST: case STATUS_SHOW_TRANSFER_LIST:
if(event->button == 1 || trans(idx - 1).tm == current_user.tm) if(event->button == 1 || trans(idx - 1).tm == current_user.tm)
callback_transfer_list_clicked(idx - 1); callback_transfer_list_clicked(idx - 1);
@ -519,8 +538,7 @@ on_menu_user_show_last_stats_activate (GtkMenuItem *menuitem,
} }
stat0 = STATUS_SHOW_LAST_MATCH_STATS; stat0 = STATUS_SHOW_LAST_MATCH_STATS;
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")), callback_show_last_match_stats();
&current_user.live_game);
} }
gboolean gboolean
@ -593,7 +611,7 @@ on_menu_show_finances_activate (GtkMenuItem *menuitem,
gpointer user_data) gpointer user_data)
{ {
stat0 = STATUS_SHOW_FINANCES; stat0 = STATUS_SHOW_FINANCES;
game_gui_print_message("Left-click on the list to get a loan. Right-click to pay back."); game_gui_print_message("Left-click: get loan; Right-click: pay back; Middle click: stadium window.");
treeview_show_finances(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")), treeview_show_finances(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")),
&current_user); &current_user);
} }
@ -708,3 +726,19 @@ on_player_menu_show_info_activate (GtkMenuItem *menuitem,
on_menu_show_info_activate(NULL, NULL); on_menu_show_info_activate(NULL, NULL);
} }
void
on_menu_rearrange_team_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
team_rearrange(current_user.tm);
treeview_show_user_player_list();
}
void
on_menu_load_last_save_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
load_save_load_game("last_save");
}

View File

@ -233,4 +233,11 @@ on_menu_browse_players_activate (GtkMenuItem *menuitem,
void void
on_player_menu_show_info_activate (GtkMenuItem *menuitem, on_player_menu_show_info_activate (GtkMenuItem *menuitem,
gpointer user_data); gpointer user_data);
void
on_menu_rearrange_team_activate (GtkMenuItem *menuitem,
gpointer user_data);
#endif #endif
void
on_menu_load_last_save_activate (GtkMenuItem *menuitem,
gpointer user_data);

View File

@ -53,13 +53,14 @@ file_add_support_directory_recursive (const gchar *directo
the full path name. the full path name.
The return value must be freed. The return value must be freed.
@param filename The name of the file we look for (without path). @param filename The name of the file we look for (without path).
@param warning Whether to show a warning if we don't find the file.
@return A pointer to the full path string of the file or NULL if @return A pointer to the full path string of the file or NULL if
we didn't find the file. The gchar* must be freed. we didn't find the file. The gchar* must be freed.
@see #support_directories @see #support_directories
@see file_add_support_directory_recursive() @see file_add_support_directory_recursive()
*/ */
gchar* gchar*
file_find_support_file (const gchar *filename) file_find_support_file (const gchar *filename, gboolean warning)
{ {
GList *elem = support_directories; GList *elem = support_directories;
@ -74,8 +75,8 @@ file_find_support_file (const gchar *filename)
elem = elem->next; elem = elem->next;
} }
/* if(opt_int("int_opt_debug")) */ if(warning)
/* g_warning("file_find_support_file: file '%s' not found.", filename); */ g_warning("file_find_support_file: file '%s' not found.", filename);
return NULL; return NULL;
} }
@ -104,7 +105,7 @@ gboolean
file_my_fopen(const gchar *filename, gchar *bits, FILE **fil, gboolean abort_program) file_my_fopen(const gchar *filename, gchar *bits, FILE **fil, gboolean abort_program)
{ {
gchar buf[SMALL]; gchar buf[SMALL];
gchar *support_file = file_find_support_file(filename); gchar *support_file = file_find_support_file(filename, FALSE);
*fil = fopen(filename, bits); *fil = fopen(filename, bits);
if(*fil != NULL) if(*fil != NULL)
@ -171,7 +172,7 @@ file_check_home_dir_copy_conf_files(void)
sprintf(buf, "%s/%s/%s", home, HOMEDIRNAME, conf_files[i]); sprintf(buf, "%s/%s/%s", home, HOMEDIRNAME, conf_files[i]);
if(!g_file_test(buf, G_FILE_TEST_EXISTS)) if(!g_file_test(buf, G_FILE_TEST_EXISTS))
{ {
conf_file = file_find_support_file(conf_files[i]); conf_file = file_find_support_file(conf_files[i], TRUE);
sprintf(buf, "cp -v %s %s/%s/%s", conf_file, home, HOMEDIRNAME, conf_files[i]); sprintf(buf, "cp -v %s %s/%s/%s", conf_file, home, HOMEDIRNAME, conf_files[i]);
file_my_system(buf); file_my_system(buf);
} }
@ -239,19 +240,19 @@ file_dir_get_contents(const gchar *dir_name, const gchar *prefix, const gchar *s
{ {
GError *error = NULL; GError *error = NULL;
GDir *dir = g_dir_open(dir_name, 0, &error); GDir *dir = g_dir_open(dir_name, 0, &error);
GPtrArray *contents = NULL; GPtrArray *contents = g_ptr_array_new();
GString *new = NULL; GString *new = NULL;
const gchar *file = NULL; const gchar *file = NULL;
misc_print_error(&error, FALSE); misc_print_error(&error, FALSE);
if(dir == NULL) if(dir == NULL)
return NULL; return contents;
file = g_dir_read_name(dir); file = g_dir_read_name(dir);
if(file != NULL) if(file == NULL)
contents = g_ptr_array_new(); return contents;
while(file != NULL) while(file != NULL)
{ {
@ -269,26 +270,34 @@ file_dir_get_contents(const gchar *dir_name, const gchar *prefix, const gchar *s
return contents; return contents;
} }
/** Return the first directory called 'definitions' from the support /** Return the country definition files found in the support dirs. */
directories array. */ GPtrArray*
const gchar* file_get_country_files(void)
file_get_definitions_dir(void)
{ {
gint i;
GList *elem = support_directories; GList *elem = support_directories;
GPtrArray *country_files = g_ptr_array_new();
GPtrArray *dir_contents = NULL;
GString *new_string = NULL;
while(elem != NULL) while(elem != NULL)
{ {
if(g_str_has_suffix((gchar*)elem->data, "definitions") || dir_contents = file_dir_get_contents((gchar*)elem->data, "country_", ".xml");
g_str_has_suffix((gchar*)elem->data, "definitions/"))
return (gchar*)elem->data; for(i=0;i<dir_contents->len;i++)
if(!query_misc_string_in_array(((GString*)g_ptr_array_index(dir_contents, i))->str,
country_files))
{
new_string = g_string_new(((GString*)g_ptr_array_index(dir_contents, i))->str);
g_ptr_array_add(country_files, new_string);
}
free_g_string_array(&dir_contents);
elem = elem->next; elem = elem->next;
} }
main_exit_program(EXIT_DIR_OPEN_FAILED, return country_files;
"Didn't find definitions directory.\n");
return NULL;
} }
/** Read the file until the next line that's not a comment or /** Read the file until the next line that's not a comment or
@ -404,7 +413,7 @@ file_load_opt_file(const gchar *filename, OptionList *optionlist)
void void
file_load_conf_files(void) file_load_conf_files(void)
{ {
gchar *conf_file = file_find_support_file("bygfoot.conf"); gchar *conf_file = file_find_support_file("bygfoot.conf", TRUE);
file_load_opt_file(conf_file, &options); file_load_opt_file(conf_file, &options);
g_free(conf_file); g_free(conf_file);
@ -421,13 +430,13 @@ file_load_user_conf_file(User *user)
gchar *conf_file = NULL, buf[SMALL]; gchar *conf_file = NULL, buf[SMALL];
sprintf(buf, "bygfoot_%s.conf", user->name->str); sprintf(buf, "bygfoot_%s.conf", user->name->str);
conf_file = file_find_support_file(buf); conf_file = file_find_support_file(buf, FALSE);
if(conf_file == NULL || if(conf_file == NULL ||
!file_my_fopen(conf_file, "r", &fil, FALSE)) !file_my_fopen(conf_file, "r", &fil, FALSE))
{ {
g_free(conf_file); g_free(conf_file);
conf_file = file_find_support_file(opt_str("string_opt_default_user_conf_file")); conf_file = file_find_support_file(opt_str("string_opt_default_user_conf_file"), TRUE);
} }
file_load_opt_file(conf_file, &user->options); file_load_opt_file(conf_file, &user->options);

View File

@ -9,7 +9,7 @@ void
file_add_support_directory_recursive (const gchar *directory); file_add_support_directory_recursive (const gchar *directory);
gchar* gchar*
file_find_support_file (const gchar *filename); file_find_support_file (const gchar *filename, gboolean warning);
gboolean gboolean
file_get_next_opt_line(FILE *fil, gchar *opt_name, gchar *opt_value); file_get_next_opt_line(FILE *fil, gchar *opt_name, gchar *opt_value);
@ -29,8 +29,8 @@ file_get_player_names(gint number_of_names);
gboolean gboolean
file_my_fopen(const gchar *filename, gchar *bits, FILE **fil, gboolean abort_program); file_my_fopen(const gchar *filename, gchar *bits, FILE **fil, gboolean abort_program);
const gchar* GPtrArray*
file_get_definitions_dir(void); file_get_country_files(void);
void void
file_load_conf_files(void); file_load_conf_files(void);

View File

@ -144,9 +144,9 @@ finance_get_loan(gint value)
sprintf(buf, _("You have %d weeks to pay back your loan."), sprintf(buf, _("You have %d weeks to pay back your loan."),
current_user.counters[COUNT_USER_LOAN]); current_user.counters[COUNT_USER_LOAN]);
game_gui_print_message(buf);
on_menu_show_finances_activate(NULL, NULL); on_menu_show_finances_activate(NULL, NULL);
game_gui_print_message(buf);
} }
@ -176,8 +176,8 @@ finance_pay_loan(gint value)
current_user.counters[COUNT_USER_LOAN]); current_user.counters[COUNT_USER_LOAN]);
} }
game_gui_print_message(buf);
on_menu_show_finances_activate(NULL, NULL); on_menu_show_finances_activate(NULL, NULL);
game_gui_print_message(buf);
} }
/** Return the cost of a stadium improvement. /** Return the cost of a stadium improvement.

View File

@ -216,7 +216,6 @@ fixture_get_round_robin_advance(const Cup *cup, gint round)
Team* Team*
fixture_winner_of(const Fixture *fix) fixture_winner_of(const Fixture *fix)
{ {
gint i;
const Fixture *first_leg; const Fixture *first_leg;
const CupRound *cupround = const CupRound *cupround =
&g_array_index(cup_from_clid(fix->clid)->rounds, CupRound, fix->round); &g_array_index(cup_from_clid(fix->clid)->rounds, CupRound, fix->round);

View File

@ -274,10 +274,9 @@ game_initialize(Fixture *fix)
if(g_array_index(fix->teams[i]->players, Player, j).cskill > 0) if(g_array_index(fix->teams[i]->players, Player, j).cskill > 0)
player_games_goals_set(&g_array_index(fix->teams[i]->players, Player, j), fix->clid, player_games_goals_set(&g_array_index(fix->teams[i]->players, Player, j), fix->clid,
PLAYER_VALUE_GAMES, 1, TRUE); PLAYER_VALUE_GAMES, 1, TRUE);
}
g_array_index(fix->teams[i]->players, Player, j).participation = g_array_index(fix->teams[i]->players, Player, j).participation = TRUE;
(j < 11 && g_array_index(fix->teams[i]->players, Player, j).cskill > 0); }
} }
if(user_idx[i] != -1) if(user_idx[i] != -1)
@ -875,8 +874,7 @@ game_post_match(Fixture *fix)
for(i=0;i<2;i++) for(i=0;i<2;i++)
{ {
if(team_is_user(fix->teams[i]) == -1 && if(team_is_user(fix->teams[i]) == -1)
fix->teams[i]->clid == fix->clid)
team_update_cpu_team(fix->teams[i], team_update_cpu_team(fix->teams[i],
(fixture_user_team_involved(fix) != -1)); (fixture_user_team_involved(fix) != -1));
else else

View File

@ -246,15 +246,15 @@ game_gui_write_meters(void)
GtkImage *image_style = GTK_IMAGE(lookup_widget(window.main, "image_style")), GtkImage *image_style = GTK_IMAGE(lookup_widget(window.main, "image_style")),
*image_boost = GTK_IMAGE(lookup_widget(window.main, "image_boost")); *image_boost = GTK_IMAGE(lookup_widget(window.main, "image_boost"));
gchar *image_style_files[5] = gchar *image_style_files[5] =
{file_find_support_file(const_str("string_game_gui_style_all_out_defend_icon")), {file_find_support_file(const_str("string_game_gui_style_all_out_defend_icon"), TRUE),
file_find_support_file(const_str("string_game_gui_style_defend_icon")), file_find_support_file(const_str("string_game_gui_style_defend_icon"), TRUE),
file_find_support_file(const_str("string_game_gui_style_balanced_icon")), file_find_support_file(const_str("string_game_gui_style_balanced_icon"), TRUE),
file_find_support_file(const_str("string_game_gui_style_attack_icon")), file_find_support_file(const_str("string_game_gui_style_attack_icon"), TRUE),
file_find_support_file(const_str("string_game_gui_style_all_out_attack_icon"))}; file_find_support_file(const_str("string_game_gui_style_all_out_attack_icon"), TRUE)};
gchar *image_boost_files[3] = gchar *image_boost_files[3] =
{file_find_support_file(const_str("string_game_gui_boost_anti_icon")), {file_find_support_file(const_str("string_game_gui_boost_anti_icon"), TRUE),
file_find_support_file(const_str("string_game_gui_boost_off_icon")), file_find_support_file(const_str("string_game_gui_boost_off_icon"), TRUE),
file_find_support_file(const_str("string_game_gui_boost_on_icon"))}; file_find_support_file(const_str("string_game_gui_boost_on_icon"), TRUE)};
gtk_image_set_from_file(image_style, image_style_files[current_user.tm->style + 2]); gtk_image_set_from_file(image_style, image_style_files[current_user.tm->style + 2]);
gtk_image_set_from_file(image_boost, image_boost_files[current_user.tm->boost + 1]); gtk_image_set_from_file(image_boost, image_boost_files[current_user.tm->boost + 1]);

View File

@ -37,6 +37,8 @@ create_main_window (void)
GtkWidget *menu_file_menu; GtkWidget *menu_file_menu;
GtkWidget *menu_new; GtkWidget *menu_new;
GtkWidget *menu_open; GtkWidget *menu_open;
GtkWidget *menu_load_last_save;
GtkWidget *image277;
GtkWidget *menu_save; GtkWidget *menu_save;
GtkWidget *menu_save_as; GtkWidget *menu_save_as;
GtkWidget *trennlinie1; GtkWidget *trennlinie1;
@ -44,7 +46,7 @@ create_main_window (void)
GtkWidget *menu_options; GtkWidget *menu_options;
GtkWidget *menu_options_menu; GtkWidget *menu_options_menu;
GtkWidget *menu_preferences; GtkWidget *menu_preferences;
GtkWidget *image264; GtkWidget *image278;
GtkWidget *trennlinie7; GtkWidget *trennlinie7;
GtkWidget *menu_job_offers; GtkWidget *menu_job_offers;
GtkWidget *menu_live_game; GtkWidget *menu_live_game;
@ -86,7 +88,9 @@ create_main_window (void)
GtkWidget *menu_boost_on; GtkWidget *menu_boost_on;
GtkWidget *menu_boost_off; GtkWidget *menu_boost_off;
GtkWidget *menu_boost_anti; GtkWidget *menu_boost_anti;
GtkWidget *trennlinie11;
GtkWidget *menu_custom_structure; GtkWidget *menu_custom_structure;
GtkWidget *menu_rearrange_team;
GtkWidget *trennlinie8; GtkWidget *trennlinie8;
GtkWidget *menu_browse_teams; GtkWidget *menu_browse_teams;
GtkWidget *menu_player; GtkWidget *menu_player;
@ -105,11 +109,11 @@ create_main_window (void)
GtkWidget *menu_user_show_last_stats; GtkWidget *menu_user_show_last_stats;
GtkWidget *trennlinie9; GtkWidget *trennlinie9;
GtkWidget *menu_next_user; GtkWidget *menu_next_user;
GtkWidget *image265; GtkWidget *image279;
GtkWidget *menu_previous_user; GtkWidget *menu_previous_user;
GtkWidget *image266; GtkWidget *image280;
GtkWidget *menu_manage_users; GtkWidget *menu_manage_users;
GtkWidget *image267; GtkWidget *image281;
GtkWidget *menu_finances_stadium; GtkWidget *menu_finances_stadium;
GtkWidget *menu_finances_stadium_menu; GtkWidget *menu_finances_stadium_menu;
GtkWidget *menu_show_finances; GtkWidget *menu_show_finances;
@ -232,6 +236,14 @@ create_main_window (void)
gtk_widget_show (menu_open); gtk_widget_show (menu_open);
gtk_container_add (GTK_CONTAINER (menu_file_menu), menu_open); gtk_container_add (GTK_CONTAINER (menu_file_menu), menu_open);
menu_load_last_save = gtk_image_menu_item_new_with_mnemonic (_("Load last save"));
gtk_widget_show (menu_load_last_save);
gtk_container_add (GTK_CONTAINER (menu_file_menu), menu_load_last_save);
image277 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
gtk_widget_show (image277);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_load_last_save), image277);
menu_save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); menu_save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
gtk_widget_show (menu_save); gtk_widget_show (menu_save);
gtk_container_add (GTK_CONTAINER (menu_file_menu), menu_save); gtk_container_add (GTK_CONTAINER (menu_file_menu), menu_save);
@ -263,9 +275,9 @@ create_main_window (void)
GDK_p, GDK_CONTROL_MASK, GDK_p, GDK_CONTROL_MASK,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
image264 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU); image278 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
gtk_widget_show (image264); gtk_widget_show (image278);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image264); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image278);
trennlinie7 = gtk_menu_item_new (); trennlinie7 = gtk_menu_item_new ();
gtk_widget_show (trennlinie7); gtk_widget_show (trennlinie7);
@ -337,25 +349,21 @@ create_main_window (void)
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_defend)); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_defend));
gtk_widget_show (menu_all_out_defend); gtk_widget_show (menu_all_out_defend);
gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_all_out_defend); gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_all_out_defend);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_all_out_defend), TRUE);
menu_defend = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Defend")); menu_defend = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Defend"));
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_defend)); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_defend));
gtk_widget_show (menu_defend); gtk_widget_show (menu_defend);
gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_defend); gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_defend);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_defend), TRUE);
menu_balanced = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Balanced")); menu_balanced = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Balanced"));
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_balanced)); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_balanced));
gtk_widget_show (menu_balanced); gtk_widget_show (menu_balanced);
gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_balanced); gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_balanced);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_balanced), TRUE);
menu_attack = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Attack")); menu_attack = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Attack"));
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_attack)); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_attack));
gtk_widget_show (menu_attack); gtk_widget_show (menu_attack);
gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_attack); gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_attack);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_attack), TRUE);
menu_all_out_attack = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("All Out Attack")); menu_all_out_attack = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("All Out Attack"));
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_attack)); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_attack));
@ -374,19 +382,16 @@ create_main_window (void)
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_best)); menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_best));
gtk_widget_show (menu_scout_best); gtk_widget_show (menu_scout_best);
gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_best); gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_best);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_best), TRUE);
menu_scout_good = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Good")); menu_scout_good = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Good"));
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_good)); menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_good));
gtk_widget_show (menu_scout_good); gtk_widget_show (menu_scout_good);
gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_good); gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_good);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_good), TRUE);
menu_scout_average = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Average")); menu_scout_average = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Average"));
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_average)); menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_average));
gtk_widget_show (menu_scout_average); gtk_widget_show (menu_scout_average);
gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_average); gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_average);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_average), TRUE);
menu_scout_bad = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Bad")); menu_scout_bad = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Bad"));
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_bad)); menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_bad));
@ -405,19 +410,16 @@ create_main_window (void)
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_best)); menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_best));
gtk_widget_show (menu_physio_best); gtk_widget_show (menu_physio_best);
gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_best); gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_best);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_best), TRUE);
menu_physio_good = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Good")); menu_physio_good = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Good"));
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_good)); menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_good));
gtk_widget_show (menu_physio_good); gtk_widget_show (menu_physio_good);
gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_good); gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_good);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_good), TRUE);
menu_physio_average = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Average")); menu_physio_average = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Average"));
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_average)); menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_average));
gtk_widget_show (menu_physio_average); gtk_widget_show (menu_physio_average);
gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_average); gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_average);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_average), TRUE);
menu_physio_bad = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Bad")); menu_physio_bad = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Bad"));
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_bad)); menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_bad));
@ -436,13 +438,11 @@ create_main_window (void)
menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_on)); menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_on));
gtk_widget_show (menu_boost_on); gtk_widget_show (menu_boost_on);
gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_on); gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_on);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_boost_on), TRUE);
menu_boost_off = gtk_radio_menu_item_new_with_mnemonic (menu_boost_on_group, _("Off")); menu_boost_off = gtk_radio_menu_item_new_with_mnemonic (menu_boost_on_group, _("Off"));
menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_off)); menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_off));
gtk_widget_show (menu_boost_off); gtk_widget_show (menu_boost_off);
gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_off); gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_off);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_boost_off), TRUE);
menu_boost_anti = gtk_radio_menu_item_new_with_mnemonic (menu_boost_on_group, _("Anti")); menu_boost_anti = gtk_radio_menu_item_new_with_mnemonic (menu_boost_on_group, _("Anti"));
menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_anti)); menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_anti));
@ -450,10 +450,23 @@ create_main_window (void)
gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_anti); gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_anti);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_boost_anti), TRUE); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_boost_anti), TRUE);
trennlinie11 = gtk_menu_item_new ();
gtk_widget_show (trennlinie11);
gtk_container_add (GTK_CONTAINER (menu_team_menu), trennlinie11);
gtk_widget_set_sensitive (trennlinie11, FALSE);
menu_custom_structure = gtk_menu_item_new_with_mnemonic (_("Enter custom structure")); menu_custom_structure = gtk_menu_item_new_with_mnemonic (_("Enter custom structure"));
gtk_widget_show (menu_custom_structure); gtk_widget_show (menu_custom_structure);
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_custom_structure); gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_custom_structure);
menu_rearrange_team = gtk_menu_item_new_with_mnemonic (_("Rearrange team"));
gtk_widget_show (menu_rearrange_team);
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_rearrange_team);
gtk_tooltips_set_tip (tooltips, menu_rearrange_team, _("Try to put the startup players onto their favoured positions and sort the substitutes (Ctrl-R or middle click)"), NULL);
gtk_widget_add_accelerator (menu_rearrange_team, "activate", accel_group,
GDK_r, GDK_CONTROL_MASK,
GTK_ACCEL_VISIBLE);
trennlinie8 = gtk_menu_item_new (); trennlinie8 = gtk_menu_item_new ();
gtk_widget_show (trennlinie8); gtk_widget_show (trennlinie8);
gtk_container_add (GTK_CONTAINER (menu_team_menu), trennlinie8); gtk_container_add (GTK_CONTAINER (menu_team_menu), trennlinie8);
@ -533,9 +546,9 @@ create_main_window (void)
GDK_F9, 0, GDK_F9, 0,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
image265 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU); image279 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
gtk_widget_show (image265); gtk_widget_show (image279);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image265); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image279);
menu_previous_user = gtk_image_menu_item_new_with_mnemonic (_("Previous user")); menu_previous_user = gtk_image_menu_item_new_with_mnemonic (_("Previous user"));
gtk_widget_show (menu_previous_user); gtk_widget_show (menu_previous_user);
@ -544,9 +557,9 @@ create_main_window (void)
GDK_F8, 0, GDK_F8, 0,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
image266 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU); image280 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
gtk_widget_show (image266); gtk_widget_show (image280);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image266); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image280);
menu_manage_users = gtk_image_menu_item_new_with_mnemonic (_("Manage users")); menu_manage_users = gtk_image_menu_item_new_with_mnemonic (_("Manage users"));
gtk_widget_show (menu_manage_users); gtk_widget_show (menu_manage_users);
@ -555,9 +568,9 @@ create_main_window (void)
GDK_F12, 0, GDK_F12, 0,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
image267 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU); image281 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
gtk_widget_show (image267); gtk_widget_show (image281);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image267); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image281);
menu_finances_stadium = gtk_menu_item_new_with_mnemonic (_("FinStad")); menu_finances_stadium = gtk_menu_item_new_with_mnemonic (_("FinStad"));
gtk_widget_show (menu_finances_stadium); gtk_widget_show (menu_finances_stadium);
@ -599,10 +612,7 @@ create_main_window (void)
gtk_widget_show (button_load); gtk_widget_show (button_load);
gtk_box_pack_start (GTK_BOX (hbox1), button_load, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX (hbox1), button_load, FALSE, FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (button_load), 2); gtk_container_set_border_width (GTK_CONTAINER (button_load), 2);
gtk_tooltips_set_tip (tooltips, button_load, _("Load game (L or Ctrl - O)"), NULL); gtk_tooltips_set_tip (tooltips, button_load, _("Load game (Ctrl - O)"), NULL);
gtk_widget_add_accelerator (button_load, "clicked", accel_group,
GDK_l, 0,
GTK_ACCEL_VISIBLE);
image11 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON); image11 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image11); gtk_widget_show (image11);
@ -613,9 +623,6 @@ create_main_window (void)
gtk_box_pack_start (GTK_BOX (hbox1), button_save, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox1), button_save, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (button_save), 2); gtk_container_set_border_width (GTK_CONTAINER (button_save), 2);
gtk_tooltips_set_tip (tooltips, button_save, _("Save game (Ctrl - S)"), NULL); gtk_tooltips_set_tip (tooltips, button_save, _("Save game (Ctrl - S)"), NULL);
gtk_widget_add_accelerator (button_save, "clicked", accel_group,
GDK_s, 0,
GTK_ACCEL_VISIBLE);
image12 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_BUTTON); image12 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image12); gtk_widget_show (image12);
@ -996,6 +1003,9 @@ create_main_window (void)
g_signal_connect ((gpointer) menu_open, "activate", g_signal_connect ((gpointer) menu_open, "activate",
G_CALLBACK (on_menu_open_activate), G_CALLBACK (on_menu_open_activate),
NULL); NULL);
g_signal_connect ((gpointer) menu_load_last_save, "activate",
G_CALLBACK (on_menu_load_last_save_activate),
NULL);
g_signal_connect ((gpointer) menu_save, "activate", g_signal_connect ((gpointer) menu_save, "activate",
G_CALLBACK (on_menu_save_activate), G_CALLBACK (on_menu_save_activate),
NULL); NULL);
@ -1083,6 +1093,9 @@ create_main_window (void)
g_signal_connect ((gpointer) menu_custom_structure, "activate", g_signal_connect ((gpointer) menu_custom_structure, "activate",
G_CALLBACK (on_menu_custom_structure_activate), G_CALLBACK (on_menu_custom_structure_activate),
NULL); NULL);
g_signal_connect ((gpointer) menu_rearrange_team, "activate",
G_CALLBACK (on_menu_rearrange_team_activate),
NULL);
g_signal_connect ((gpointer) menu_browse_teams, "activate", g_signal_connect ((gpointer) menu_browse_teams, "activate",
G_CALLBACK (on_menu_browse_teams_activate), G_CALLBACK (on_menu_browse_teams_activate),
NULL); NULL);
@ -1191,6 +1204,8 @@ create_main_window (void)
GLADE_HOOKUP_OBJECT (main_window, menu_file_menu, "menu_file_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_file_menu, "menu_file_menu");
GLADE_HOOKUP_OBJECT (main_window, menu_new, "menu_new"); GLADE_HOOKUP_OBJECT (main_window, menu_new, "menu_new");
GLADE_HOOKUP_OBJECT (main_window, menu_open, "menu_open"); GLADE_HOOKUP_OBJECT (main_window, menu_open, "menu_open");
GLADE_HOOKUP_OBJECT (main_window, menu_load_last_save, "menu_load_last_save");
GLADE_HOOKUP_OBJECT (main_window, image277, "image277");
GLADE_HOOKUP_OBJECT (main_window, menu_save, "menu_save"); GLADE_HOOKUP_OBJECT (main_window, menu_save, "menu_save");
GLADE_HOOKUP_OBJECT (main_window, menu_save_as, "menu_save_as"); GLADE_HOOKUP_OBJECT (main_window, menu_save_as, "menu_save_as");
GLADE_HOOKUP_OBJECT (main_window, trennlinie1, "trennlinie1"); GLADE_HOOKUP_OBJECT (main_window, trennlinie1, "trennlinie1");
@ -1198,7 +1213,7 @@ create_main_window (void)
GLADE_HOOKUP_OBJECT (main_window, menu_options, "menu_options"); 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_options_menu, "menu_options_menu");
GLADE_HOOKUP_OBJECT (main_window, menu_preferences, "menu_preferences"); GLADE_HOOKUP_OBJECT (main_window, menu_preferences, "menu_preferences");
GLADE_HOOKUP_OBJECT (main_window, image264, "image264"); GLADE_HOOKUP_OBJECT (main_window, image278, "image278");
GLADE_HOOKUP_OBJECT (main_window, trennlinie7, "trennlinie7"); GLADE_HOOKUP_OBJECT (main_window, trennlinie7, "trennlinie7");
GLADE_HOOKUP_OBJECT (main_window, menu_job_offers, "menu_job_offers"); GLADE_HOOKUP_OBJECT (main_window, menu_job_offers, "menu_job_offers");
GLADE_HOOKUP_OBJECT (main_window, menu_live_game, "menu_live_game"); GLADE_HOOKUP_OBJECT (main_window, menu_live_game, "menu_live_game");
@ -1236,7 +1251,9 @@ create_main_window (void)
GLADE_HOOKUP_OBJECT (main_window, menu_boost_on, "menu_boost_on"); GLADE_HOOKUP_OBJECT (main_window, menu_boost_on, "menu_boost_on");
GLADE_HOOKUP_OBJECT (main_window, menu_boost_off, "menu_boost_off"); GLADE_HOOKUP_OBJECT (main_window, menu_boost_off, "menu_boost_off");
GLADE_HOOKUP_OBJECT (main_window, menu_boost_anti, "menu_boost_anti"); GLADE_HOOKUP_OBJECT (main_window, menu_boost_anti, "menu_boost_anti");
GLADE_HOOKUP_OBJECT (main_window, trennlinie11, "trennlinie11");
GLADE_HOOKUP_OBJECT (main_window, menu_custom_structure, "menu_custom_structure"); GLADE_HOOKUP_OBJECT (main_window, menu_custom_structure, "menu_custom_structure");
GLADE_HOOKUP_OBJECT (main_window, menu_rearrange_team, "menu_rearrange_team");
GLADE_HOOKUP_OBJECT (main_window, trennlinie8, "trennlinie8"); GLADE_HOOKUP_OBJECT (main_window, trennlinie8, "trennlinie8");
GLADE_HOOKUP_OBJECT (main_window, menu_browse_teams, "menu_browse_teams"); GLADE_HOOKUP_OBJECT (main_window, menu_browse_teams, "menu_browse_teams");
GLADE_HOOKUP_OBJECT (main_window, menu_player, "menu_player"); GLADE_HOOKUP_OBJECT (main_window, menu_player, "menu_player");
@ -1255,11 +1272,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, menu_user_show_last_stats, "menu_user_show_last_stats");
GLADE_HOOKUP_OBJECT (main_window, trennlinie9, "trennlinie9"); GLADE_HOOKUP_OBJECT (main_window, trennlinie9, "trennlinie9");
GLADE_HOOKUP_OBJECT (main_window, menu_next_user, "menu_next_user"); GLADE_HOOKUP_OBJECT (main_window, menu_next_user, "menu_next_user");
GLADE_HOOKUP_OBJECT (main_window, image265, "image265"); GLADE_HOOKUP_OBJECT (main_window, image279, "image279");
GLADE_HOOKUP_OBJECT (main_window, menu_previous_user, "menu_previous_user"); GLADE_HOOKUP_OBJECT (main_window, menu_previous_user, "menu_previous_user");
GLADE_HOOKUP_OBJECT (main_window, image266, "image266"); GLADE_HOOKUP_OBJECT (main_window, image280, "image280");
GLADE_HOOKUP_OBJECT (main_window, menu_manage_users, "menu_manage_users"); GLADE_HOOKUP_OBJECT (main_window, menu_manage_users, "menu_manage_users");
GLADE_HOOKUP_OBJECT (main_window, image267, "image267"); GLADE_HOOKUP_OBJECT (main_window, image281, "image281");
GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium, "menu_finances_stadium"); 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_finances_stadium_menu, "menu_finances_stadium_menu");
GLADE_HOOKUP_OBJECT (main_window, menu_show_finances, "menu_show_finances"); GLADE_HOOKUP_OBJECT (main_window, menu_show_finances, "menu_show_finances");

View File

@ -1555,6 +1555,9 @@ live_game_reset(LiveGame *live_game, Fixture *fix, gboolean free_variable)
live_game->stats.values[1][i] = 0; live_game->stats.values[1][i] = 0;
live_game->fix = fix; live_game->fix = fix;
live_game->fix_clid = (fix != NULL) ? fix->clid : -1;
live_game->fix_idx = (fix != NULL) ? fixture_get_index(fix) : -1;
live_game->subs_left[0] = live_game->subs_left[1] = 3; live_game->subs_left[0] = live_game->subs_left[1] = 3;
live_game->stadium_event = -1; live_game->stadium_event = -1;

View File

@ -190,6 +190,9 @@ typedef struct
{ {
/** The fixture that belongs to the game. */ /** The fixture that belongs to the game. */
Fixture *fix; Fixture *fix;
/** Integers determining the fixture (needed because fixture pointers
can change when new fixtures are added to the fixtures array). */
gint fix_clid, fix_idx;
/** Substitutions left for the teams. */ /** Substitutions left for the teams. */
gint subs_left[2]; gint subs_left[2];
/** The team that started the game, 0 or 1. */ /** The team that started the game, 0 or 1. */

View File

@ -1,3 +1,4 @@
#include "callbacks.h"
#include "file.h" #include "file.h"
#include "gui.h" #include "gui.h"
#include "game_gui.h" #include "game_gui.h"
@ -12,7 +13,7 @@
#include "xml_loadsave_transfers.h" #include "xml_loadsave_transfers.h"
#include "xml.h" #include "xml.h"
#define PROGRESS_MAX 6 #define PROGRESS_MAX 7
/** Save the game to the specified file. */ /** Save the game to the specified file. */
void void
@ -40,6 +41,16 @@ load_save_save_game(const gchar *filename)
xml_loadsave_misc_write(prefix); xml_loadsave_misc_write(prefix);
gui_show_progress(
((PROGRESS_MAX * gtk_progress_bar_get_fraction(
GTK_PROGRESS_BAR(lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX,
"Saving options/constants...");
sprintf(buf, "%s___options", prefix);
file_save_opt_file(buf, &options);
sprintf(buf, "%s___constants", prefix);
file_save_opt_file(buf, &constants);
gui_show_progress( gui_show_progress(
((PROGRESS_MAX * gtk_progress_bar_get_fraction( ((PROGRESS_MAX * gtk_progress_bar_get_fraction(
GTK_PROGRESS_BAR(lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX, GTK_PROGRESS_BAR(lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX,
@ -98,6 +109,25 @@ load_save_load_game(const gchar* filename)
*dirname = g_path_get_dirname(filename); *dirname = g_path_get_dirname(filename);
gchar *prefix = g_strndup(basename, strlen(basename) - strlen(const_str("string_save_suffix"))); gchar *prefix = g_strndup(basename, strlen(basename) - strlen(const_str("string_save_suffix")));
if(strcmp(basename, "last_save") == 0)
{
g_free(basename);
g_free(dirname);
g_free(prefix);
basename = load_save_last_save_get();
if(basename != NULL)
{
load_save_load_game(basename);
g_free(basename);
}
else
g_warning("load_save_load_game: last save file not found.\n");
return;
}
gui_show_progress(0, "Uncompressing savegame..."); gui_show_progress(0, "Uncompressing savegame...");
file_decompress(filename); file_decompress(filename);
@ -109,6 +139,16 @@ load_save_load_game(const gchar* filename)
xml_loadsave_misc_read(dirname, prefix); xml_loadsave_misc_read(dirname, prefix);
gui_show_progress(
((PROGRESS_MAX * gtk_progress_bar_get_fraction(
GTK_PROGRESS_BAR(lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX,
"Loading options/constants...");
sprintf(buf, "%s___options", prefix);
file_load_opt_file(buf, &options);
sprintf(buf, "%s___constants", prefix);
file_load_opt_file(buf, &constants);
gui_show_progress( gui_show_progress(
((PROGRESS_MAX * gtk_progress_bar_get_fraction( ((PROGRESS_MAX * gtk_progress_bar_get_fraction(
GTK_PROGRESS_BAR(lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX, GTK_PROGRESS_BAR(lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX,
@ -150,6 +190,9 @@ load_save_load_game(const gchar* filename)
gui_show_progress(-1, ""); gui_show_progress(-1, "");
setsav1; setsav1;
cur_user = 0;
on_button_back_to_main_clicked(NULL, NULL);
} }
/** Store the name of the last savegame in the users home dir. */ /** Store the name of the last savegame in the users home dir. */

View File

@ -230,7 +230,7 @@ misc_truncate_string(const gchar *src, gchar *dest, gint number_of_chars)
/** Find out whether the first string contains the second string. */ /** Find out whether the first string contains the second string. */
gboolean gboolean
misc_string_contains(const gchar *string, const gchar *text) query_misc_string_contains(const gchar *string, const gchar *text)
{ {
gint i, j; gint i, j;
gint lens = strlen(string), gint lens = strlen(string),
@ -254,3 +254,16 @@ misc_string_contains(const gchar *string, const gchar *text)
return FALSE; return FALSE;
} }
/** Check whether the string is in the GString array. */
gboolean
query_misc_string_in_array(const gchar *string, GPtrArray *array)
{
gint i;
for(i=0;i<array->len;i++)
if(strcmp(string, ((GString*)g_ptr_array_index(array, i))->str) == 0)
return TRUE;
return FALSE;
}

View File

@ -34,6 +34,9 @@ void
misc_truncate_string(const gchar *src, gchar *dest, gint number_of_chars); misc_truncate_string(const gchar *src, gchar *dest, gint number_of_chars);
gboolean gboolean
misc_string_contains(const gchar *string, const gchar *text); query_misc_string_contains(const gchar *string, const gchar *text);
gboolean
query_misc_string_in_array(const gchar *string, GPtrArray *array);
#endif #endif

View File

@ -113,7 +113,7 @@ misc2_callback_contract_offer(void)
pl->contract += (i + 1); pl->contract += (i + 1);
pl->wage = value; pl->wage = value;
sprintf(buf, _("%s accepts your offer."), pl->name->str); sprintf(buf, _("%s accepts your offer."), pl->name->str);
game_gui_print_message(buf); game_gui_show_warning(buf);
window_destroy(&window.contract, FALSE); window_destroy(&window.contract, FALSE);
} }
else else

View File

@ -221,6 +221,4 @@ misc_callback_startup_load(const gchar *filename)
window_create(WINDOW_MAIN); window_create(WINDOW_MAIN);
xml_name_read(opt_str("string_opt_player_names_file"), 1000); xml_name_read(opt_str("string_opt_player_names_file"), 1000);
load_save_load_game(filename); load_save_load_game(filename);
cur_user = 0;
on_button_back_to_main_clicked(NULL, NULL);
} }

View File

@ -84,11 +84,7 @@ on_button_fsel_ok_clicked (GtkButton *button,
if(stat1 == STATUS_SAVE_GAME) if(stat1 == STATUS_SAVE_GAME)
load_save_save_game(filename); load_save_save_game(filename);
else if(stat1 == STATUS_LOAD_GAME) else if(stat1 == STATUS_LOAD_GAME)
{
load_save_load_game(filename); load_save_load_game(filename);
cur_user = 0;
on_button_back_to_main_clicked(NULL, NULL);
}
else if(stat1 == STATUS_LOAD_GAME_TEAM_SELECTION) else if(stat1 == STATUS_LOAD_GAME_TEAM_SELECTION)
misc_callback_startup_load(filename); misc_callback_startup_load(filename);
@ -269,6 +265,9 @@ on_button_stadium_ok_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
misc_callback_improve_stadium(); misc_callback_improve_stadium();
if(stat0 == STATUS_SHOW_FINANCES)
on_menu_show_finances_activate(NULL, NULL);
} }
@ -298,12 +297,15 @@ void
on_button_startup_resume_clicked (GtkButton *button, on_button_startup_resume_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
gchar *last_save = load_save_last_save_get(); misc_callback_startup_load("last_save");
if(last_save == NULL)
return;
misc_callback_startup_load(last_save);
g_free(last_save);
} }
gboolean
on_window_stadium_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
return TRUE;
}

View File

@ -118,3 +118,8 @@ void
on_button_startup_resume_clicked (GtkButton *button, on_button_startup_resume_clicked (GtkButton *button,
gpointer user_data); gpointer user_data);
#endif #endif
gboolean
on_window_stadium_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);

View File

@ -336,7 +336,7 @@ create_window_startup (void)
gtk_widget_show (image61); gtk_widget_show (image61);
gtk_box_pack_start (GTK_BOX (hbox68), image61, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox68), image61, FALSE, FALSE, 0);
label108 = gtk_label_new_with_mnemonic (_("Resume last game")); label108 = gtk_label_new_with_mnemonic (_("_Resume last game"));
gtk_widget_show (label108); gtk_widget_show (label108);
gtk_box_pack_start (GTK_BOX (hbox68), label108, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox68), label108, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label108), GTK_JUSTIFY_LEFT); gtk_label_set_justify (GTK_LABEL (label108), GTK_JUSTIFY_LEFT);
@ -1175,6 +1175,9 @@ create_window_stadium (void)
GDK_Escape, 0, GDK_Escape, 0,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
g_signal_connect ((gpointer) window_stadium, "delete_event",
G_CALLBACK (on_window_stadium_delete_event),
NULL);
g_signal_connect ((gpointer) spinbutton_capacity, "value_changed", g_signal_connect ((gpointer) spinbutton_capacity, "value_changed",
G_CALLBACK (on_spinbutton_capacity_value_changed), G_CALLBACK (on_spinbutton_capacity_value_changed),
NULL); NULL);

View File

@ -1,3 +1,4 @@
#include "callbacks.h"
#include "file.h" #include "file.h"
#include "option.h" #include "option.h"
#include "option_gui.h" #include "option_gui.h"
@ -387,10 +388,13 @@ option_gui_write_options(void)
for(i=0;i<ENTRY_OPT_END;i++) for(i=0;i<ENTRY_OPT_END;i++)
{ {
if(i == ENTRY_OPT_CONSTANTS &&
strcmp(gtk_entry_get_text(entry_widgets[i]), opt_str("string_opt_constants_file" )) != 0)
file_load_opt_file(gtk_entry_get_text(entry_widgets[i]), &constants);
g_string_printf(entry_options[i], "%s", gtk_entry_get_text(entry_widgets[i])); g_string_printf(entry_options[i], "%s", gtk_entry_get_text(entry_widgets[i]));
if(i == ENTRY_OPT_CONSTANTS &&
strcmp(gtk_entry_get_text(entry_widgets[i]), opt_str("string_opt_constants_file")) != 0)
file_load_opt_file(gtk_entry_get_text(entry_widgets[i]), &constants);
else if(i == ENTRY_OPT_FONT_NAME &&
strcmp(gtk_entry_get_text(entry_widgets[i]), opt_str("string_opt_font_name")) != 0)
on_button_back_to_main_clicked(NULL, NULL);
} }
} }

View File

@ -668,7 +668,10 @@ player_update_fitness(Player *pl)
gfloat increase = -1; gfloat increase = -1;
if(pl->participation) if(pl->participation)
{
pl->participation = FALSE;
return; return;
}
for(i=0;i<7;i++) for(i=0;i<7;i++)
if(diff > age_limits[i]) if(diff > age_limits[i])
@ -946,6 +949,7 @@ player_update_weekly(Team *tm, gint idx)
pl->age += 0.0192; pl->age += 0.0192;
pl->contract -= 0.0192; pl->contract -= 0.0192;
/*todo: warning*/
if(pl->contract <= 0) if(pl->contract <= 0)
player_remove_contract(tm, idx); player_remove_contract(tm, idx);
@ -981,9 +985,6 @@ player_remove_from_team(Team *tm, gint idx)
void void
player_update_post_match(Player *pl, gint clid) player_update_post_match(Player *pl, gint clid)
{ {
if(pl->health == 0)
player_update_fitness(pl);
if(player_card_get(pl, clid, PLAYER_VALUE_CARD_RED) > 0) if(player_card_get(pl, clid, PLAYER_VALUE_CARD_RED) > 0)
player_card_set(pl, clid, PLAYER_VALUE_CARD_RED, -1, TRUE); player_card_set(pl, clid, PLAYER_VALUE_CARD_RED, -1, TRUE);
} }
@ -1018,8 +1019,11 @@ player_update_week_roundly(Team *tm, gint idx)
{ {
Player *pl = player_of(tm, idx); Player *pl = player_of(tm, idx);
if(pl->health == 0)
player_update_fitness(pl);
pl->cskill = (pl->health > 0 || player_is_banned(pl) > 0) ? pl->cskill = (pl->health > 0 || player_is_banned(pl) > 0) ?
0 : player_get_cskill(pl, pl->cpos); 0 : player_get_cskill(pl, pl->cpos);
} }
/** Return injury descriptions. */ /** Return injury descriptions. */

View File

@ -162,7 +162,7 @@ end_week_round_results(void)
gchar buf[SMALL], buf2[SMALL]; gchar buf[SMALL], buf2[SMALL];
gfloat num_matches = gfloat num_matches =
(gfloat)fixture_get_number_of_matches(week, week_round); (gfloat)fixture_get_number_of_matches(week, week_round);
if(week_round == 1) if(week_round == 1)
{ {
for(i=0;i<ligs->len;i++) for(i=0;i<ligs->len;i++)
@ -172,6 +172,7 @@ end_week_round_results(void)
g_array_index(lig(i).fixtures, Fixture, j).attendance == -1) g_array_index(lig(i).fixtures, Fixture, j).attendance == -1)
{ {
live_game_calculate_fixture(&g_array_index(lig(i).fixtures, Fixture, j)); live_game_calculate_fixture(&g_array_index(lig(i).fixtures, Fixture, j));
done++; done++;
fixture_result_to_buf(&g_array_index(lig(i).fixtures, Fixture, j), buf); fixture_result_to_buf(&g_array_index(lig(i).fixtures, Fixture, j), buf);
sprintf(buf2, "%s %s %s", sprintf(buf2, "%s %s %s",
@ -190,6 +191,7 @@ end_week_round_results(void)
g_array_index(cp(i).fixtures, Fixture, j).attendance == -1) g_array_index(cp(i).fixtures, Fixture, j).attendance == -1)
{ {
live_game_calculate_fixture(&g_array_index(cp(i).fixtures, Fixture, j)); live_game_calculate_fixture(&g_array_index(cp(i).fixtures, Fixture, j));
done++; done++;
fixture_result_to_buf(&g_array_index(cp(i).fixtures, Fixture, j), buf); fixture_result_to_buf(&g_array_index(cp(i).fixtures, Fixture, j), buf);
sprintf(buf2, "%s %s %s", sprintf(buf2, "%s %s %s",

View File

@ -664,10 +664,17 @@ team_update_cpu_corrections(Team *tm, gboolean reset_fitness)
for(i=0;i<tm->players->len;i++) for(i=0;i<tm->players->len;i++)
{ {
pl = player_of(tm, i); pl = player_of(tm, i);
for(j=0;j<pl->cards->len;j++)
g_array_index(pl->cards, PlayerCard, j).red = 0;
if(pl->cskill == 0) if(pl->cskill == 0)
{ {
pl->health = pl->recovery = 0; pl->health = pl->recovery = 0;
pl->cskill = player_get_cskill(pl, pl->cpos); pl->cskill = player_get_cskill(pl, pl->cpos);
pl->fitness = math_rnd(const_float("float_player_fitness_lower"),
const_float("float_player_fitness_upper"));
} }
if(pl->pos != pl->cpos) if(pl->pos != pl->cpos)
@ -676,18 +683,16 @@ team_update_cpu_corrections(Team *tm, gboolean reset_fitness)
pl->cskill = player_get_cskill(pl, pl->cpos); pl->cskill = player_get_cskill(pl, pl->cpos);
} }
for(j=0;j<pl->cards->len;j++)
g_array_index(pl->cards, PlayerCard, j).red = 0;
if(reset_fitness) if(reset_fitness)
pl->fitness = math_rnd(const_float("float_player_fitness_lower"), pl->fitness = math_rnd(const_float("float_player_fitness_lower"),
const_float("float_player_fitness_upper")); const_float("float_player_fitness_upper"));
} }
team_rearrange(tm);
tm->structure = team_find_appropriate_structure(tm); tm->structure = team_find_appropriate_structure(tm);
if(!player_substitution_good_structure(tm->structure, if(!player_substitution_good_structure(tm->structure, PLAYER_POS_DEFENDER, PLAYER_POS_DEFENDER))
player_of(tm, 1)->pos, player_of(tm, 1)->pos))
{ {
tm->structure = team_assign_playing_structure(); tm->structure = team_assign_playing_structure();
for(i=0;i<tm->players->len;i++) for(i=0;i<tm->players->len;i++)
@ -755,7 +760,7 @@ team_update_cpu_new_players(Team *tm)
/** Heal players, re-set fitnesses, make some random subs /** Heal players, re-set fitnesses, make some random subs
and replace some players with new ones. and replace some players with new ones.
@param tm The team we examine. @param tm The team we examine.
@param reset_fitness Whether to reset the fitness values of playes. */ @param reset_fitness Whether to reset the fitness values of players. */
void void
team_update_cpu_team(Team *tm, gboolean reset_fitness) team_update_cpu_team(Team *tm, gboolean reset_fitness)
{ {

View File

@ -241,7 +241,7 @@ treeview_pixbuf_from_filename(gchar *filename)
if(filename != NULL && strlen(filename) != 0) if(filename != NULL && strlen(filename) != 0)
{ {
symbol_file = file_find_support_file(filename); symbol_file = file_find_support_file(filename, FALSE);
if(symbol_file != NULL) if(symbol_file != NULL)
{ {
symbol = gdk_pixbuf_new_from_file(symbol_file, &error); symbol = gdk_pixbuf_new_from_file(symbol_file, &error);
@ -1010,7 +1010,7 @@ treeview_create_game_stats(LiveGame *live_game)
gchar buf[2][SMALL]; gchar buf[2][SMALL];
gchar buf3[SMALL]; gchar buf3[SMALL];
gchar *categories[LIVE_GAME_STAT_VALUE_END] = gchar *categories[LIVE_GAME_STAT_VALUE_END] =
{_("Goals (w/o pen.)"), {_("Goals (regular)"),
_("Shots"), _("Shots"),
_("Shot %"), _("Shot %"),
_("Possession"), _("Possession"),
@ -1616,6 +1616,37 @@ treeview_show_table(GtkTreeView *treeview, gint clid)
g_object_unref(model); g_object_unref(model);
} }
/** Print some quick info about the stadium in the finances view. */
void
treeview_create_stadium_summary(GtkListStore *liststore)
{
gchar buf[SMALL];
GtkTreeIter iter;
gtk_list_store_append(liststore, &iter);
misc_print_grouped_int(current_user.tm->stadium.capacity, buf, FALSE);
gtk_list_store_set(liststore, &iter, 0, _("Stadium capacity"), 1, buf, 2, "", -1);
gtk_list_store_append(liststore, &iter);
sprintf(buf, "%.0f", current_user.tm->stadium.safety * 100);
gtk_list_store_set(liststore, &iter, 0, _("Stadium safety"), 1, buf, 2, "", -1);
if(current_user.counters[COUNT_USER_STADIUM_CAPACITY] +
current_user.counters[COUNT_USER_STADIUM_SAFETY] != 0)
{
gtk_list_store_append(liststore, &iter);
sprintf(buf, _("Improvement in progress.\n%d seats and %d%% safety still to be done.\nExpected finish: %d weeks."),
current_user.counters[COUNT_USER_STADIUM_CAPACITY],
current_user.counters[COUNT_USER_STADIUM_SAFETY],
MAX(finance_get_stadium_improvement_duration(
(gfloat)current_user.counters[COUNT_USER_STADIUM_CAPACITY], TRUE),
finance_get_stadium_improvement_duration(
(gfloat)current_user.counters[COUNT_USER_STADIUM_SAFETY] / 100, FALSE)));
gtk_list_store_set(liststore, &iter, 0, _("Stadium status"), 1, buf, 2, "", -1);
}
}
GtkTreeModel* GtkTreeModel*
treeview_create_finances(const User* user) treeview_create_finances(const User* user)
{ {
@ -1711,6 +1742,11 @@ treeview_create_finances(const User* user)
gtk_list_store_set(liststore, &iter, 0, buf, 1, "", 2, buf2, -1); gtk_list_store_set(liststore, &iter, 0, buf, 1, "", 2, buf2, -1);
} }
gtk_list_store_append(liststore, &iter);
gtk_list_store_set(liststore, &iter, 0, "", 1, "", 2, "", -1);
treeview_create_stadium_summary(liststore);
return GTK_TREE_MODEL(liststore); return GTK_TREE_MODEL(liststore);
} }

View File

@ -210,4 +210,7 @@ treeview_create_player_info(const Player *pl);
gint gint
treeview_iter_get_row(GtkTreeModel *model, GtkTreeIter *iter); treeview_iter_get_row(GtkTreeModel *model, GtkTreeIter *iter);
void
treeview_create_stadium_summary(GtkListStore *liststore);
#endif #endif

View File

@ -161,7 +161,7 @@ treeview_cell_player_info_banned_to_cell(GtkCellRenderer *renderer, const GArray
for(i=0;i<cards->len;i++) for(i=0;i<cards->len;i++)
if(g_array_index(cards, PlayerCard, i).red > 0) if(g_array_index(cards, PlayerCard, i).red > 0)
{ {
sprintf(buf2, "%s: %d weeks ", sprintf(buf2, "%s: %d weeks\n",
league_cup_get_name_string(g_array_index(cards, PlayerCard, i).clid), league_cup_get_name_string(g_array_index(cards, PlayerCard, i).clid),
g_array_index(cards, PlayerCard, i).red); g_array_index(cards, PlayerCard, i).red);
strcat(buf, buf2); strcat(buf, buf2);
@ -191,12 +191,12 @@ treeview_cell_player_info_yellow_to_cell(GtkCellRenderer *renderer, const GArray
{ {
if(yellow_red < 1000) if(yellow_red < 1000)
{ {
sprintf(buf2, "%s: %d (%d) ", sprintf(buf2, "%s: %d (%d)\n",
league_cup_get_name_string(g_array_index(cards, PlayerCard, i).clid), league_cup_get_name_string(g_array_index(cards, PlayerCard, i).clid),
g_array_index(cards, PlayerCard, i).yellow, yellow_red); g_array_index(cards, PlayerCard, i).yellow, yellow_red);
} }
else else
sprintf(buf2, "%s: %d (no limit) ", sprintf(buf2, "%s: %d (no limit)\n",
league_cup_get_name_string(g_array_index(cards, PlayerCard, i).clid), league_cup_get_name_string(g_array_index(cards, PlayerCard, i).clid),
g_array_index(cards, PlayerCard, i).yellow); g_array_index(cards, PlayerCard, i).yellow);
@ -217,7 +217,7 @@ treeview_cell_player_info_games_goals_to_cell(GtkCellRenderer *renderer, const G
for(i=0;i<games_goals->len;i++) for(i=0;i<games_goals->len;i++)
{ {
sprintf(buf2, "%s: %d/%d ", sprintf(buf2, "%s: %d/%d\n",
league_cup_get_name_string(g_array_index(games_goals, PlayerGamesGoals, i).clid), league_cup_get_name_string(g_array_index(games_goals, PlayerGamesGoals, i).clid),
g_array_index(games_goals, PlayerGamesGoals, i).games, g_array_index(games_goals, PlayerGamesGoals, i).games,
g_array_index(games_goals, PlayerGamesGoals, i).goals); g_array_index(games_goals, PlayerGamesGoals, i).goals);

View File

@ -4,6 +4,7 @@
#include "game_gui.h" #include "game_gui.h"
#include "gui.h" #include "gui.h"
#include "interface.h" #include "interface.h"
#include "main.h"
#include "misc_interface.h" #include "misc_interface.h"
#include "misc2_interface.h" #include "misc2_interface.h"
#include "option.h" #include "option.h"
@ -24,22 +25,22 @@ window_show_startup(void)
window_create(WINDOW_STARTUP); window_create(WINDOW_STARTUP);
GtkWidget *combo_country = GtkWidget *combo_country =
lookup_widget(window_startup, "combo_country"); lookup_widget(window_startup, "combo_country");
const gchar *country_dir; GPtrArray *country_files = NULL;
GPtrArray *dir_contents = NULL;
GList *combo_strings = NULL; GList *combo_strings = NULL;
gint i; gint i;
country_dir = file_get_definitions_dir(); country_files = file_get_country_files();
dir_contents = file_dir_get_contents(country_dir, "country_", ""); if(country_files->len == 0)
main_exit_program(EXIT_NO_COUNTRY_FILES, "Didn't find any country definition files in the support directories.");
for(i=0;i<dir_contents->len;i++) for(i=0;i<country_files->len;i++)
combo_strings = g_list_append(combo_strings, combo_strings = g_list_append(combo_strings,
((GString*)g_ptr_array_index(dir_contents, i))->str); ((GString*)g_ptr_array_index(country_files, i))->str);
gtk_combo_set_popdown_strings(GTK_COMBO(combo_country), combo_strings); gtk_combo_set_popdown_strings(GTK_COMBO(combo_country), combo_strings);
free_g_string_array(&dir_contents); free_g_string_array(&country_files);
} }
/** Show the file selection window. */ /** Show the file selection window. */

View File

@ -65,7 +65,7 @@ xml_load_leagues(const gchar *dirname, const gchar *basename)
if(!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table.xml") && if(!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table.xml") &&
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") && !g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") &&
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml") && !g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml") &&
!misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str, "_promcup")) !query_misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str, "_promcup"))
xml_load_league(dirname, ((GString*)g_ptr_array_index(dir_contents, i))->str, xml_load_league(dirname, ((GString*)g_ptr_array_index(dir_contents, i))->str,
dir_contents); dir_contents);
@ -107,7 +107,7 @@ xml_load_league(const gchar *dirname, const gchar *basename, const GPtrArray *di
for(i=0;i<dir_contents->len;i++) for(i=0;i<dir_contents->len;i++)
if(g_str_has_prefix(((GString*)g_ptr_array_index(dir_contents, i))->str, buf) && if(g_str_has_prefix(((GString*)g_ptr_array_index(dir_contents, i))->str, buf) &&
!misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table") && !query_misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table") &&
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") && !g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") &&
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml")) !g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml"))
{ {
@ -134,7 +134,7 @@ xml_load_cups(const gchar *dirname, const gchar *basename)
for(i=0;i<dir_contents->len;i++) for(i=0;i<dir_contents->len;i++)
{ {
if(!misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table") && if(!query_misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table") &&
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") && !g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") &&
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml")) !g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml"))
xml_load_cup(dirname, ((GString*)g_ptr_array_index(dir_contents, i))->str, xml_load_cup(dirname, ((GString*)g_ptr_array_index(dir_contents, i))->str,
@ -177,7 +177,7 @@ xml_load_cup(const gchar *dirname, const gchar *basename, const GPtrArray *dir_c
{ {
if(g_str_has_prefix(((GString*)g_ptr_array_index(dir_contents, i))->str, if(g_str_has_prefix(((GString*)g_ptr_array_index(dir_contents, i))->str,
prefix) && prefix) &&
misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str, query_misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str,
"_table")) "_table"))
{ {
new_table = table_new(); new_table = table_new();

View File

@ -149,7 +149,7 @@ xml_country_read_text (GMarkupParseContext *context,
void void
xml_country_read(const gchar *country_name) xml_country_read(const gchar *country_name)
{ {
gchar *file_name = file_find_support_file(country_name); gchar *file_name = file_find_support_file(country_name, FALSE);
GMarkupParser parser = {xml_country_read_start_element, GMarkupParser parser = {xml_country_read_start_element,
xml_country_read_end_element, xml_country_read_end_element,
xml_country_read_text, NULL, NULL}; xml_country_read_text, NULL, NULL};
@ -165,7 +165,7 @@ xml_country_read(const gchar *country_name)
if(file_name == NULL) if(file_name == NULL)
{ {
sprintf(buf, "country_%s.xml", country_name); sprintf(buf, "country_%s.xml", country_name);
file_name = file_find_support_file(buf); file_name = file_find_support_file(buf, TRUE);
} }
if(!g_file_get_contents(file_name, &file_contents, &length, &error)) if(!g_file_get_contents(file_name, &file_contents, &length, &error))

View File

@ -312,7 +312,7 @@ xml_cup_read_text (GMarkupParseContext *context,
void void
xml_cup_read(const gchar *cup_name, GArray *cups) xml_cup_read(const gchar *cup_name, GArray *cups)
{ {
gchar *file_name = file_find_support_file(cup_name); gchar *file_name = file_find_support_file(cup_name, FALSE);
GMarkupParser parser = {xml_cup_read_start_element, GMarkupParser parser = {xml_cup_read_start_element,
xml_cup_read_end_element, xml_cup_read_end_element,
xml_cup_read_text, NULL, NULL}; xml_cup_read_text, NULL, NULL};
@ -328,7 +328,7 @@ xml_cup_read(const gchar *cup_name, GArray *cups)
if(file_name == NULL) if(file_name == NULL)
{ {
sprintf(buf, "cup_%s.xml", cup_name); sprintf(buf, "cup_%s.xml", cup_name);
file_name = file_find_support_file(buf); file_name = file_find_support_file(buf, TRUE);
} }
if(!g_file_get_contents(file_name, &file_contents, &length, &error)) if(!g_file_get_contents(file_name, &file_contents, &length, &error))

View File

@ -295,7 +295,7 @@ xml_league_read(const gchar *league_name, GArray *leagues)
{ {
gint i; gint i;
TableElement new_table_element; TableElement new_table_element;
gchar *file_name = file_find_support_file(league_name); gchar *file_name = file_find_support_file(league_name, FALSE);
GMarkupParser parser = {xml_league_read_start_element, GMarkupParser parser = {xml_league_read_start_element,
xml_league_read_end_element, xml_league_read_end_element,
xml_league_read_text, NULL, NULL}; xml_league_read_text, NULL, NULL};
@ -311,7 +311,7 @@ xml_league_read(const gchar *league_name, GArray *leagues)
if(file_name == NULL) if(file_name == NULL)
{ {
sprintf(buf, "league_%s.xml", league_name); sprintf(buf, "league_%s.xml", league_name);
file_name = file_find_support_file(buf); file_name = file_find_support_file(buf, TRUE);
} }
if(!g_file_get_contents(file_name, &file_contents, &length, &error)) if(!g_file_get_contents(file_name, &file_contents, &length, &error))

View File

@ -154,10 +154,13 @@ xml_loadsave_live_game_text (GMarkupParseContext *context,
int_value = (gint)g_ascii_strtod(buf, NULL); int_value = (gint)g_ascii_strtod(buf, NULL);
if(state == TAG_LIVE_GAME_FIX_CLID) if(state == TAG_LIVE_GAME_FIX_CLID)
fix_clid = int_value; lgame->fix_clid = int_value;
else if(state == TAG_LIVE_GAME_FIX_IDX) else if(state == TAG_LIVE_GAME_FIX_IDX)
lgame->fix = &g_array_index(league_cup_get_fixtures(fix_clid), {
lgame->fix_idx = int_value;
lgame->fix = &g_array_index(league_cup_get_fixtures(lgame->fix_clid),
Fixture, int_value); Fixture, int_value);
}
else if(state == TAG_LIVE_GAME_UNIT_POSSESSION) else if(state == TAG_LIVE_GAME_UNIT_POSSESSION)
new_unit.possession = int_value; new_unit.possession = int_value;
else if(state == TAG_LIVE_GAME_UNIT_AREA) else if(state == TAG_LIVE_GAME_UNIT_AREA)

View File

@ -91,7 +91,7 @@ void
xml_name_read(const gchar *names_file, gint number_of_names) xml_name_read(const gchar *names_file, gint number_of_names)
{ {
gint i; gint i;
gchar *file_name = file_find_support_file(names_file); gchar *file_name = file_find_support_file(names_file, FALSE);
GMarkupParser parser = {xml_name_read_start_element, GMarkupParser parser = {xml_name_read_start_element,
xml_name_read_end_element, xml_name_read_end_element,
xml_name_read_text, NULL, NULL}; xml_name_read_text, NULL, NULL};

View File

@ -484,7 +484,7 @@ int_team_subs_upper 3
float_team_new_style 1000 float_team_new_style 1000
# prob that the team structure gets changed # prob that the team structure gets changed
float_team_new_structure 500 float_team_new_structure 2000
# the influence of the fitness on the current skill. # the influence of the fitness on the current skill.
# this determines the player's contribution to the team # this determines the player's contribution to the team
@ -746,7 +746,7 @@ string_treeview_opponent_skill_positive_fg darkred
string_treeview_opponent_skill_negative_fg darkgreen string_treeview_opponent_skill_negative_fg darkgreen
# background of the home column in the league results # background of the home column in the league results
string_treeview_league_results_away_bg lightgrey string_treeview_league_results_away_bg white
string_treeview_league_results_away_fg black string_treeview_league_results_away_fg black
# foreground of own team bar in the opponent preview # foreground of own team bar in the opponent preview