mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-02-14 10:30:48 +01:00
"CPU strategies, first draft."
This commit is contained in:
parent
56ea866eda
commit
3b23bb353f
@ -1,3 +1,7 @@
|
||||
11/16/2005: v1.9.3
|
||||
- updated German country definition (thanks to Sebastian Vöcking)
|
||||
|
||||
|
||||
10/16/2005: v1.9.2
|
||||
- fixed some minor bugs
|
||||
- updated translations
|
||||
|
File diff suppressed because one or more lines are too long
125
bygfoot.glade
125
bygfoot.glade
@ -68,7 +68,7 @@
|
||||
<accelerator key="l" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2107">
|
||||
<widget class="GtkImage" id="image2151">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-revert-to-saved</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -136,7 +136,7 @@
|
||||
<accelerator key="p" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2108">
|
||||
<widget class="GtkImage" id="image2152">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -200,10 +200,9 @@
|
||||
<signal name="activate" handler="on_menu_save_window_geometry_activate" last_modification_time="Tue, 27 Sep 2005 10:09:53 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2109">
|
||||
<widget class="GtkImage" id="image2153">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-save</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="pixbuf">menu_save_geometry.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
@ -235,7 +234,7 @@
|
||||
<accelerator key="F3" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2110">
|
||||
<widget class="GtkImage" id="image2154">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_fixtures.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -256,7 +255,7 @@
|
||||
<accelerator key="F4" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2111">
|
||||
<widget class="GtkImage" id="image2155">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_fixtures_comp.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -277,7 +276,7 @@
|
||||
<accelerator key="F5" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2112">
|
||||
<widget class="GtkImage" id="image2156">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_table.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -298,7 +297,7 @@
|
||||
<accelerator key="F6" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2113">
|
||||
<widget class="GtkImage" id="image2157">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_league_results.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -319,7 +318,7 @@
|
||||
<accelerator key="s" modifiers="GDK_SHIFT_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2114">
|
||||
<widget class="GtkImage" id="image2158">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_season_res.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -346,7 +345,7 @@
|
||||
<accelerator key="s" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2115">
|
||||
<widget class="GtkImage" id="image2159">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_league_stats.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -367,7 +366,7 @@
|
||||
<accelerator key="h" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2116">
|
||||
<widget class="GtkImage" id="image2160">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_history.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -399,7 +398,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2117">
|
||||
<widget class="GtkImage" id="image2161">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_style.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -417,7 +416,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">All Out Defend</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:16:56 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -427,7 +426,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Defend</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:17:07 GMT"/>
|
||||
</widget>
|
||||
@ -438,7 +437,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Balanced</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:17:14 GMT"/>
|
||||
</widget>
|
||||
@ -449,7 +448,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Attack</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:17:20 GMT"/>
|
||||
</widget>
|
||||
@ -477,7 +476,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2118">
|
||||
<widget class="GtkImage" id="image2162">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_scout.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -495,7 +494,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Best</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:15:47 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -505,7 +504,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Good</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_scout_best</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:15:35 GMT"/>
|
||||
</widget>
|
||||
@ -516,7 +515,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Average</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_scout_best</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:15:54 GMT"/>
|
||||
</widget>
|
||||
@ -544,7 +543,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2119">
|
||||
<widget class="GtkImage" id="image2163">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_physio.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -562,7 +561,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Best</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:16:14 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -572,7 +571,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Good</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_physio_best</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:16:21 GMT"/>
|
||||
</widget>
|
||||
@ -583,7 +582,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Average</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_physio_best</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:16:28 GMT"/>
|
||||
</widget>
|
||||
@ -611,7 +610,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2120">
|
||||
<widget class="GtkImage" id="image2164">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_youth_academy.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -648,7 +647,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Best</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Thu, 07 Jul 2005 14:50:03 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -658,7 +657,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Good</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_yc_best</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Thu, 07 Jul 2005 14:50:03 GMT"/>
|
||||
</widget>
|
||||
@ -669,7 +668,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Average</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_yc_best</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Thu, 07 Jul 2005 14:50:03 GMT"/>
|
||||
</widget>
|
||||
@ -704,7 +703,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Goalies</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Thu, 14 Jul 2005 07:26:30 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -714,7 +713,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Defenders</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_recruit0</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Thu, 14 Jul 2005 07:29:19 GMT"/>
|
||||
</widget>
|
||||
@ -725,7 +724,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Midfielders</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_recruit0</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Thu, 14 Jul 2005 07:29:14 GMT"/>
|
||||
</widget>
|
||||
@ -736,7 +735,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Forwards</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_recruit0</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Thu, 14 Jul 2005 07:29:09 GMT"/>
|
||||
</widget>
|
||||
@ -778,7 +777,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2121">
|
||||
<widget class="GtkImage" id="image2165">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_boost.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -796,7 +795,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">On</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Tue, 08 Mar 2005 16:37:57 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -806,7 +805,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Off</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_boost_on</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Tue, 08 Mar 2005 16:37:48 GMT"/>
|
||||
</widget>
|
||||
@ -841,7 +840,7 @@
|
||||
<signal name="activate" handler="on_menu_reset_players_activate" last_modification_time="Tue, 26 Apr 2005 13:16:39 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2122">
|
||||
<widget class="GtkImage" id="image2166">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-undo</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -862,7 +861,7 @@
|
||||
<signal name="activate" handler="on_menu_custom_structure_activate" last_modification_time="Sat, 26 Feb 2005 12:46:30 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2123">
|
||||
<widget class="GtkImage" id="image2167">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_structure.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -884,7 +883,7 @@
|
||||
<accelerator key="r" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2124">
|
||||
<widget class="GtkImage" id="image2168">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_rearrange.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -910,7 +909,7 @@
|
||||
<signal name="activate" handler="on_menu_browse_teams_activate" last_modification_time="Mon, 03 Jan 2005 16:58:58 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2125">
|
||||
<widget class="GtkImage" id="image2169">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_browse_tms.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -943,7 +942,7 @@
|
||||
<signal name="activate" handler="on_menu_show_info_activate" last_modification_time="Sun, 02 Jan 2005 15:42:09 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2126">
|
||||
<widget class="GtkImage" id="image2170">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_info.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -963,7 +962,7 @@
|
||||
<signal name="activate" handler="on_menu_put_on_transfer_list_activate" last_modification_time="Sun, 02 Jan 2005 15:42:09 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2127">
|
||||
<widget class="GtkImage" id="image2171">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_put_transfer.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -983,7 +982,7 @@
|
||||
<signal name="activate" handler="on_menu_remove_from_transfer_list_activate" last_modification_time="Sun, 02 Jan 2005 15:42:09 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2128">
|
||||
<widget class="GtkImage" id="image2172">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_remove_transfer.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1003,7 +1002,7 @@
|
||||
<signal name="activate" handler="on_menu_offer_new_contract_activate" last_modification_time="Fri, 25 Mar 2005 09:23:28 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2129">
|
||||
<widget class="GtkImage" id="image2173">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_contract.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1023,7 +1022,7 @@
|
||||
<signal name="activate" handler="on_menu_fire_activate" last_modification_time="Sun, 02 Jan 2005 15:42:09 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2130">
|
||||
<widget class="GtkImage" id="image2174">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_fire.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1043,7 +1042,7 @@
|
||||
<signal name="activate" handler="on_menu_shoots_penalties_activate" last_modification_time="Sun, 02 Jan 2005 15:42:09 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2131">
|
||||
<widget class="GtkImage" id="image2175">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_shoots.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1063,7 +1062,7 @@
|
||||
<signal name="activate" handler="on_menu_move_to_youth_academy_activate" last_modification_time="Thu, 07 Jul 2005 21:12:26 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2132">
|
||||
<widget class="GtkImage" id="image2176">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_move_to_ya.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1089,7 +1088,7 @@
|
||||
<signal name="activate" handler="on_menu_browse_players_activate" last_modification_time="Sat, 26 Mar 2005 09:42:31 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2133">
|
||||
<widget class="GtkImage" id="image2177">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_browse.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1123,7 +1122,7 @@
|
||||
<accelerator key="v" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2134">
|
||||
<widget class="GtkImage" id="image2178">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_last_match.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1144,7 +1143,7 @@
|
||||
<accelerator key="F2" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2135">
|
||||
<widget class="GtkImage" id="image2179">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_match_stats.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1165,7 +1164,7 @@
|
||||
<accelerator key="F1" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2136">
|
||||
<widget class="GtkImage" id="image2180">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -1185,7 +1184,7 @@
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2137">
|
||||
<widget class="GtkImage" id="image2181">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_mmatches.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1208,7 +1207,7 @@
|
||||
<accelerator key="a" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2138">
|
||||
<widget class="GtkImage" id="image2182">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -1231,7 +1230,7 @@
|
||||
<accelerator key="m" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2139">
|
||||
<widget class="GtkImage" id="image2183">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -1263,7 +1262,7 @@
|
||||
<accelerator key="h" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2140">
|
||||
<widget class="GtkImage" id="image2184">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_history.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1290,7 +1289,7 @@
|
||||
<accelerator key="F9" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2141">
|
||||
<widget class="GtkImage" id="image2185">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-media-forward</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -1312,7 +1311,7 @@
|
||||
<accelerator key="F8" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2142">
|
||||
<widget class="GtkImage" id="image2186">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-go-back</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -1334,7 +1333,7 @@
|
||||
<accelerator key="F12" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2143">
|
||||
<widget class="GtkImage" id="image2187">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-justify-fill</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -1369,7 +1368,7 @@
|
||||
<accelerator key="f" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2144">
|
||||
<widget class="GtkImage" id="image2188">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_finances.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1390,7 +1389,7 @@
|
||||
<accelerator key="f" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2145">
|
||||
<widget class="GtkImage" id="image2189">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_stadium.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
@ -1423,7 +1422,7 @@
|
||||
<signal name="activate" handler="on_menu_about_activate" last_modification_time="Sun, 18 Jan 2004 15:58:22 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2146">
|
||||
<widget class="GtkImage" id="image2190">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-info</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -1444,7 +1443,7 @@
|
||||
<signal name="activate" handler="on_menu_contributors_activate" last_modification_time="Sun, 22 May 2005 06:42:11 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2147">
|
||||
<widget class="GtkImage" id="image2191">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -1465,7 +1464,7 @@
|
||||
<signal name="activate" handler="on_menu_help_activate" last_modification_time="Sun, 22 May 2005 06:42:11 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2148">
|
||||
<widget class="GtkImage" id="image2192">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-help</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1075,6 +1075,51 @@
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow13">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="treeview_lg_opponent">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label118">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Opponent player list</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -10,7 +10,7 @@ AC_PROG_CC
|
||||
AM_PROG_CC_STDC
|
||||
AC_HEADER_STDC
|
||||
|
||||
pkg_modules="gtk+-2.0 >= 2.4"
|
||||
pkg_modules="gtk+-2.0 >= 2.6"
|
||||
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
|
||||
AC_SUBST(PACKAGE_CFLAGS)
|
||||
AC_SUBST(PACKAGE_LIBS)
|
||||
@ -20,7 +20,7 @@ AC_SUBST(GETTEXT_PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
|
||||
|
||||
dnl Add the languages which your application supports here.
|
||||
ALL_LINGUAS="de nl fr pl ro bg zh es"
|
||||
ALL_LINGUAS="de nl fr pl ro bg zh es da"
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
|
||||
AC_OUTPUT([
|
||||
|
@ -10,12 +10,14 @@ src/interface.c
|
||||
src/lg_commentary.c
|
||||
src/live_game.c
|
||||
src/load_save.c
|
||||
src/main.c
|
||||
src/misc2_callback_func.c
|
||||
src/misc2_callbacks.c
|
||||
src/misc2_interface.c
|
||||
src/misc_callback_func.c
|
||||
src/misc_callbacks.c
|
||||
src/misc_interface.c
|
||||
src/nonsourcestrings.c
|
||||
src/options_interface.c
|
||||
src/player.c
|
||||
src/support.c
|
||||
|
@ -26,7 +26,7 @@ bygfoot_SOURCES = \
|
||||
league.c cup.h free.h league.h main.h maths.h misc.h option.h player.h stat.h table.h team.h user.h variables.h \
|
||||
live_game.c callbacks.h fixture.h free.h game_gui.h game.h league.h lg_commentary.h live_game.h main.h maths.h misc_callback_func.h misc.h option.h player.h support.h team.h treeview.h user.h variables.h window.h \
|
||||
load_save.c callbacks.h file.h game_gui.h gui.h language.h load_save.h misc.h option.h support.h user.h variables.h window.h xml.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_leagues_cups.h xml_loadsave_misc.h xml_loadsave_season_stats.h xml_loadsave_transfers.h xml_loadsave_users.h \
|
||||
main.c file.h free.h language.h lg_commentary_struct.h live_game.h load_save.h main.h misc_callbacks.h misc.h name_struct.h option.h stat_struct.h transfer_struct.h variables.h window.h \
|
||||
main.c file.h free.h language.h lg_commentary_struct.h live_game.h load_save.h main.h misc_callbacks.h misc.h name_struct.h option.h stat_struct.h team_struct.h transfer_struct.h variables.h window.h \
|
||||
maths.c maths.h misc.h variables.h \
|
||||
misc.c main.h maths.h misc.h \
|
||||
misc_callbacks.c callback_func.h callbacks.h game_gui.h game.h gui.h live_game.h load_save.h main.h maths.h misc_callback_func.h misc_callbacks.h option.h user.h variables.h window.h xml_country.h \
|
||||
@ -41,11 +41,12 @@ bygfoot_SOURCES = \
|
||||
options_callbacks.c file.h option_gui.h options_callbacks.h options_interface.h support.h user.h variables.h window.h \
|
||||
options_interface.c options_callbacks.h options_interface.h support.h \
|
||||
player.c cup.h fixture.h free.h game_gui.h league.h main.h maths.h misc.h name.h option.h player.h team.h transfer.h user.h \
|
||||
start_end.c cup.h file.h finance.h fixture.h free.h game_gui.h gui.h league.h live_game.h load_save.h main.h maths.h misc.h name.h option.h start_end.h stat.h table.h team.h transfer.h user.h variables.h xml_name.h youth_academy.h \
|
||||
start_end.c cup.h file.h finance.h fixture.h free.h game_gui.h gui.h league.h live_game.h load_save.h main.h maths.h misc.h name.h option.h start_end.h stat.h table.h team.h transfer.h user.h variables.h xml_name.h xml_strategy.h youth_academy.h \
|
||||
stat.c cup.h free.h league.h option.h player.h stat.h table_struct.h team.h variables.h \
|
||||
strategy.c main.h misc.h player.h strategy.h team.h \
|
||||
support.c support.h \
|
||||
table.c cup.h league.h misc.h table.h variables.h \
|
||||
team.c cup.h file.h fixture.h game_gui.h game.h league.h main.h maths.h misc.h option.h player.h team.h transfer.h user.h xml_team.h \
|
||||
team.c cup.h file.h fixture.h game_gui.h game.h league.h main.h maths.h misc.h option.h player.h strategy.h team.h transfer.h user.h xml_team.h \
|
||||
transfer.c callbacks.h cup.h finance.h free.h game_gui.h main.h maths.h misc.h option.h player.h support.h team.h transfer.h treeview.h user.h \
|
||||
treeview.c cup.h finance.h fixture.h free.h game.h language.h league.h live_game.h maths.h misc.h option.h player.h support.h team.h transfer.h treeview.h treeview_helper.h user.h \
|
||||
treeview2.c fixture.h league.h live_game.h option.h support.h treeview2.h treeview_helper.h user.h \
|
||||
@ -72,6 +73,7 @@ bygfoot_SOURCES = \
|
||||
xml_lg_commentary.c free.h lg_commentary.h live_game.h misc.h variables.h xml_lg_commentary.h \
|
||||
xml_mmatches.c file.h free.h live_game.h misc.h user.h xml.h xml_loadsave_live_game.h xml_mmatches.h \
|
||||
xml_name.c file.h free.h misc.h name.h variables.h xml_name.h \
|
||||
xml_strategy.c file.h free.h main.h misc.h team_struct.h xml_strategy.h \
|
||||
xml_team.c file.h free.h main.h misc.h option.h player.h team.h variables.h xml_team.h \
|
||||
youth_academy.c free.h maths.h name.h option.h player.h team.h user.h youth_academy.h
|
||||
|
||||
|
@ -111,6 +111,7 @@ enum ExitCodes
|
||||
EXIT_LOAD_TEAM_DEF, /**< Error loading a team definition file. */
|
||||
EXIT_DEF_SORT, /**< Error sorting a team after loading the definition. */
|
||||
EXIT_PROM_REL, /**< Error when executing the promotion/relegation stuff. */
|
||||
EXIT_STRATEGY_ERROR, /**< Error related to CPU strategies. */
|
||||
EXIT_END
|
||||
};
|
||||
|
||||
|
81
src/cup.c
81
src/cup.c
@ -213,11 +213,9 @@ cup_get_choose_team_league_cup(const CupChooseTeam *ct,
|
||||
}
|
||||
|
||||
if(*league == NULL && *cup == NULL)
|
||||
{
|
||||
g_warning("cup_get_choose_team_league_cup: no league nor cup found for chooseteam %s",
|
||||
ct->sid);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR,
|
||||
"cup_get_choose_team_league_cup: no league nor cup found for chooseteam %s",
|
||||
ct->sid);
|
||||
}
|
||||
|
||||
/** Load the pointers to the teams participating in the
|
||||
@ -338,22 +336,20 @@ cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
|
||||
|
||||
if(ct->number_of_teams != -1 &&
|
||||
number_of_teams != ct->number_of_teams)
|
||||
{
|
||||
g_warning("cup_load_choose_team (1): not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found) cup group %d.\n ",
|
||||
ct->sid, cup->name, ct->number_of_teams, number_of_teams, cup->group);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR,
|
||||
"cup_load_choose_team (1): not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found) cup group %d.\n ",
|
||||
ct->sid, cup->name, ct->number_of_teams,
|
||||
number_of_teams, cup->group);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(season == 1 && cup->add_week == 0)
|
||||
{
|
||||
if(lig(0).teams->len < ct->number_of_teams)
|
||||
{
|
||||
g_warning("cup_load_choose_team: not enough teams in league 0 for chooseteam %s (%d; required: %d) in cup %s\n",
|
||||
ct->sid, lig(0).teams->len, ct->number_of_teams, cup->name);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR,
|
||||
"cup_load_choose_team: not enough teams in league 0 for chooseteam %s (%d; required: %d) in cup %s\n",
|
||||
ct->sid, lig(0).teams->len,
|
||||
ct->number_of_teams, cup->name);
|
||||
|
||||
gint permutation[lig(0).teams->len];
|
||||
math_generate_permutation(permutation, 0, lig(0).teams->len - 1);
|
||||
@ -377,11 +373,10 @@ cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
|
||||
}
|
||||
|
||||
if(number_of_teams != ct->number_of_teams)
|
||||
{
|
||||
g_warning("cup_load_choose_team (2): not enough teams found in league 0 for chooseteam %s (%d; required: %d) in cup %s (group %d)\n",
|
||||
ct->sid, number_of_teams, ct->number_of_teams, cup->name, cup->group);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR,
|
||||
"cup_load_choose_team (2): not enough teams found in league 0 for chooseteam %s (%d; required: %d) in cup %s (group %d)\n",
|
||||
ct->sid, number_of_teams,
|
||||
ct->number_of_teams, cup->name, cup->group);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -417,11 +412,10 @@ cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
|
||||
|
||||
if(ct->number_of_teams != -1 &&
|
||||
number_of_teams != ct->number_of_teams)
|
||||
{
|
||||
g_warning("cup_load_choose_team(3): not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found) cup group %d.\n ",
|
||||
ct->sid, cup->name, ct->number_of_teams, number_of_teams, cup->group);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR,
|
||||
"cup_load_choose_team(3): not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found) cup group %d.\n ",
|
||||
ct->sid, cup->name,
|
||||
ct->number_of_teams, number_of_teams, cup->group);
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,11 +488,11 @@ cup_load_choose_team_generate(Cup *cup, CupRound *cup_round, const CupChooseTeam
|
||||
|
||||
if(teams_local->len < end_idx)
|
||||
{
|
||||
g_warning("cup_load_choose_team_generate: not enough teams (%d) in chooseteam %s in cup %s (%d are specified) \n",
|
||||
teams_local->len, ct->sid, cup->name, end_idx);
|
||||
|
||||
free_teams_array(&teams_local, FALSE);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR,
|
||||
"cup_load_choose_team_generate: not enough teams (%d) in chooseteam %s in cup %s (%d are specified) \n",
|
||||
teams_local->len, ct->sid,
|
||||
cup->name, end_idx);
|
||||
}
|
||||
|
||||
for(j = 0; j < end_idx; j++)
|
||||
@ -520,11 +514,11 @@ cup_load_choose_team_generate(Cup *cup, CupRound *cup_round, const CupChooseTeam
|
||||
if(((ct->number_of_teams != -1 && number_of_teams != ct->number_of_teams) ||
|
||||
(ct->number_of_teams == -1 && number_of_teams != teams_local->len)) &&
|
||||
teams_local->len > 0)
|
||||
{
|
||||
g_warning("cup_load_choose_team_generate: not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found).\n ", ct->sid, cup->name, ct->number_of_teams, number_of_teams);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR,
|
||||
"cup_load_choose_team_generate: not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found).\n ",
|
||||
ct->sid, cup->name,
|
||||
ct->number_of_teams, number_of_teams);
|
||||
|
||||
for(j=teams_local->len - 1; j>=0;j--)
|
||||
if(query_team_is_in_cup(&g_array_index(teams_local, Team, j), cup))
|
||||
g_array_remove_index(teams_local, j);
|
||||
@ -691,11 +685,10 @@ cup_get_first_week_of_cup_round(const Cup *cup, gint cup_round)
|
||||
cup_get_matchdays_in_cup_round(cup, cup_round) * cup->week_gap;
|
||||
|
||||
if(week_number <= 0)
|
||||
{
|
||||
g_warning("cup_get_first_week_of_cup_round: first week of cup %s cup round %d is not positive (%d).\nPlease lower the week gap or set a later last week.\n", cup->name, cup_round, week_number);
|
||||
main_exit_program(EXIT_FIRST_WEEK_ERROR, NULL);
|
||||
}
|
||||
|
||||
main_exit_program(EXIT_FIRST_WEEK_ERROR,
|
||||
"cup_get_first_week_of_cup_round: first week of cup %s cup round %d is not positive (%d).\nPlease lower the week gap or set a later last week.\n",
|
||||
cup->name, cup_round, week_number);
|
||||
|
||||
return week_number;
|
||||
}
|
||||
|
||||
@ -859,9 +852,8 @@ cup_from_clid(gint clid)
|
||||
if(cp(i).id == clid)
|
||||
return &cp(i);
|
||||
|
||||
g_warning("cup_from_clid: didn't find cup with id %d\n", clid);
|
||||
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"cup_from_clid: didn't find cup with id %d\n", clid);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -876,9 +868,8 @@ cup_from_sid(const gchar *sid)
|
||||
if(strcmp(cp(i).sid, sid) == 0)
|
||||
return &cp(i);
|
||||
|
||||
g_warning("cup_from_sid: didn't find cup with sid %s \n", sid);
|
||||
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"cup_from_sid: didn't find cup with sid %s \n", sid);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
12
src/file.c
12
src/file.c
@ -55,7 +55,6 @@ file_add_support_directory_recursive (const gchar *directo
|
||||
add_pixmap_directory(directory);
|
||||
support_directories = g_list_prepend (support_directories,
|
||||
g_strdup (directory));
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
file = g_dir_read_name(newdir);
|
||||
@ -139,7 +138,6 @@ file_my_system(const gchar *command)
|
||||
gboolean
|
||||
file_my_fopen(const gchar *filename, gchar *bits, FILE **fil, gboolean abort_program)
|
||||
{
|
||||
gchar buf[SMALL];
|
||||
gchar *support_file = file_find_support_file(filename, FALSE);
|
||||
*fil = fopen(filename, bits);
|
||||
|
||||
@ -156,9 +154,7 @@ file_my_fopen(const gchar *filename, gchar *bits, FILE **fil, gboolean abort_pro
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
sprintf(buf, "Could not open file '%s' in mode '%s'.\n", filename, bits);
|
||||
|
||||
g_warning(buf);
|
||||
g_warning("Could not open file '%s' in mode '%s'.\n", filename, bits);
|
||||
|
||||
if(abort_program)
|
||||
main_exit_program(EXIT_FILE_OPEN_FAILED, NULL);
|
||||
@ -481,10 +477,10 @@ file_load_conf_files(void)
|
||||
|
||||
file_load_opt_file(opt_str("string_opt_constants_file"), &constants);
|
||||
file_load_opt_file(opt_str("string_opt_appearance_file"), &constants_app);
|
||||
file_load_opt_file("bygfoot_lg_tokens", &lg_tokens);
|
||||
file_load_opt_file("bygfoot_tokens", &tokens);
|
||||
|
||||
for(i=0;i<lg_tokens.list->len;i++)
|
||||
g_array_index(lg_tokens.list, Option, i).value = i;
|
||||
for(i=0;i<tokens.list->len;i++)
|
||||
g_array_index(tokens.list, Option, i).value = i;
|
||||
}
|
||||
|
||||
/** Load a user-specific conf file.
|
||||
|
@ -105,10 +105,10 @@ fixture_update(Cup *cup)
|
||||
|
||||
if(round + 1 > cup->rounds->len - 1)
|
||||
{
|
||||
g_warning("fixture_update: round index %d too high for round array (%d) in cup %s\n",
|
||||
round + 1, cup->rounds->len - 1, cup->name);
|
||||
g_ptr_array_free(teams, TRUE);
|
||||
main_exit_program(EXIT_CUP_ROUND_ERROR, NULL);
|
||||
main_exit_program(EXIT_CUP_ROUND_ERROR,
|
||||
"fixture_update: round index %d too high for round array (%d) in cup %s\n",
|
||||
round + 1, cup->rounds->len - 1, cup->name);
|
||||
}
|
||||
|
||||
new_round = &g_array_index(cup->rounds, CupRound, round + 1);
|
||||
@ -309,10 +309,9 @@ fixture_write_cup_round_robin(Cup *cup, gint cup_round, GPtrArray *teams)
|
||||
TableElement new_table_element;
|
||||
|
||||
if(teams->len < number_of_groups)
|
||||
{
|
||||
g_warning("fixture_write_cup_round_robin: cup %s round %d: number of teams (%d) less than number of groups (%d)\n", cup->name, cup_round, teams->len, number_of_groups);
|
||||
main_exit_program(EXIT_FIXTURE_WRITE_ERROR, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_FIXTURE_WRITE_ERROR,
|
||||
"fixture_write_cup_round_robin: cup %s round %d: number of teams (%d) less than number of groups (%d)\n",
|
||||
cup->name, cup_round, teams->len, number_of_groups);
|
||||
|
||||
if(cupround->randomise_teams || opt_int("int_opt_randomise_teams"))
|
||||
g_ptr_array_sort_with_data(teams, (GCompareDataFunc)team_compare_func,
|
||||
@ -421,11 +420,10 @@ fixture_write_round_robin(gpointer league_cup, gint cup_round, GPtrArray *teams,
|
||||
first_fixture = fixtures->len;
|
||||
|
||||
if(first_week < 1)
|
||||
{
|
||||
g_warning("fixture_write_round_robin: first week of %s is not positive (%d).\nPlease lower the week gap or set a later last week.\n", league_cup_get_name_string(clid), first_week);
|
||||
main_exit_program(EXIT_FIXTURE_WRITE_ERROR, NULL);
|
||||
}
|
||||
|
||||
main_exit_program(EXIT_FIXTURE_WRITE_ERROR,
|
||||
"fixture_write_round_robin: first week of %s is not positive (%d).\nPlease lower the week gap or set a later last week.\n",
|
||||
league_cup_get_name_string(clid), first_week);
|
||||
|
||||
if(len % 2 != 0)
|
||||
{
|
||||
team_temp = team_new(FALSE);
|
||||
@ -1120,9 +1118,8 @@ fixture_from_id(gint id)
|
||||
if(g_array_index(cp(i).fixtures, Fixture, j).id == id)
|
||||
return &g_array_index(cp(i).fixtures, Fixture, j);
|
||||
|
||||
g_warning("fixture_from_id: fixture with id %d found \n", id);
|
||||
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"fixture_from_id: fixture with id %d found \n", id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -1272,3 +1269,69 @@ fixture_get_season_results(void)
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/** Calculate how many goals the team has to score to
|
||||
win the match (also taking into account second leg stuff). */
|
||||
gint
|
||||
fixture_get_goals_to_win(const Fixture *fix, const Team *tm)
|
||||
{
|
||||
const Fixture *first_leg = NULL;
|
||||
gint idx = (tm == fix->teams[1]), return_value = -100;
|
||||
gint res[2] = {math_sum_int_array(fix->result[0], 2),
|
||||
math_sum_int_array(fix->result[1], 2)};
|
||||
gint tmp;
|
||||
|
||||
if(!query_fixture_team_involved(fix, tm->id))
|
||||
{
|
||||
g_warning("fixture_get_goals_to_win: team %s doesn't participate in fixture given (%s)\n",
|
||||
tm->name, league_cup_get_name_string(fix->clid));
|
||||
return -100;
|
||||
}
|
||||
|
||||
if(!fix->second_leg)
|
||||
return res[!idx] - res[idx] + 1;
|
||||
|
||||
first_leg = fixture_get_first_leg(fix);
|
||||
|
||||
if(res[0] + first_leg->result[1][0] ==
|
||||
res[1] + first_leg->result[0][0])
|
||||
{
|
||||
if(idx == 0)
|
||||
return_value = (res[1] >= first_leg->result[1][0]) ?
|
||||
1 : 0;
|
||||
else
|
||||
return_value = (res[1] > first_leg->result[1][0]) ?
|
||||
0 : 1;
|
||||
}
|
||||
else if(res[0] + first_leg->result[1][0] >
|
||||
res[1] + first_leg->result[0][0])
|
||||
{
|
||||
tmp = res[1];
|
||||
while(res[0] + first_leg->result[1][0] >
|
||||
res[1] + first_leg->result[0][0])
|
||||
res[1]++;
|
||||
|
||||
if(idx == 0)
|
||||
return_value = (res[1] >= first_leg->result[1][0]) ?
|
||||
tmp - res[1] + 1 : tmp - res[1];
|
||||
else
|
||||
return_value = (res[1] > first_leg->result[1][0]) ?
|
||||
res[1] - tmp : res[1] - tmp + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = res[0];
|
||||
while(res[0] + first_leg->result[1][0] <
|
||||
res[1] + first_leg->result[0][0])
|
||||
res[0]++;
|
||||
|
||||
if(idx == 0)
|
||||
return_value = (res[1] >= first_leg->result[1][0]) ?
|
||||
res[0] - tmp + 1 : res[0] - tmp;
|
||||
else
|
||||
return_value = (res[1] > first_leg->result[1][0]) ?
|
||||
tmp - res[0] : tmp - res[0] + 1;
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
@ -151,4 +151,7 @@ fixture_get_week_list(gint week_number, gint week_round_number);
|
||||
GPtrArray*
|
||||
fixture_get_season_results(void);
|
||||
|
||||
gint
|
||||
fixture_get_goals_to_win(const Fixture *fix, const Team *tm);
|
||||
|
||||
#endif
|
||||
|
39
src/free.c
39
src/free.c
@ -23,6 +23,7 @@
|
||||
|
||||
#include "free.h"
|
||||
#include "lg_commentary_struct.h"
|
||||
#include "strategy_struct.h"
|
||||
#include "transfer.h"
|
||||
#include "user.h"
|
||||
#include "variables.h"
|
||||
@ -37,6 +38,7 @@ free_memory(void)
|
||||
free_variables();
|
||||
free_names(FALSE);
|
||||
free_transfer_list();
|
||||
free_strategies();
|
||||
free_country(FALSE);
|
||||
free_users(FALSE);
|
||||
free_live_game(&live_game_temp);
|
||||
@ -500,7 +502,7 @@ free_variables(void)
|
||||
free_option_list(&settings, FALSE);
|
||||
free_option_list(&constants, FALSE);
|
||||
free_option_list(&constants_app, FALSE);
|
||||
free_option_list(&lg_tokens, FALSE);
|
||||
free_option_list(&tokens, FALSE);
|
||||
|
||||
free_gchar_ptr(save_file);
|
||||
|
||||
@ -667,3 +669,38 @@ free_names(gboolean reset)
|
||||
if(reset)
|
||||
name_lists = g_array_new(FALSE, FALSE, sizeof(NameList));
|
||||
}
|
||||
|
||||
/** Free the array with the CPU strategies. */
|
||||
void
|
||||
free_strategies(void)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
for(i=0;i<strategies->len;i++)
|
||||
{
|
||||
g_free(g_array_index(strategies, Strategy, i).sid);
|
||||
g_free(g_array_index(strategies, Strategy, i).desc);
|
||||
|
||||
for(j=0;j<g_array_index(strategies, Strategy, i).prematch->len;j++)
|
||||
{
|
||||
g_free(
|
||||
g_array_index(
|
||||
g_array_index(
|
||||
strategies, Strategy, i).prematch, StrategyPrematch, j).condition);
|
||||
g_array_free(
|
||||
g_array_index(
|
||||
g_array_index(strategies, Strategy, i).prematch, StrategyPrematch, j).formations,
|
||||
TRUE);
|
||||
}
|
||||
g_array_free(g_array_index(strategies, Strategy, i).prematch, TRUE);
|
||||
|
||||
for(j=0;j<g_array_index(strategies, Strategy, i).match_action->len;j++)
|
||||
g_free(
|
||||
g_array_index(
|
||||
g_array_index(
|
||||
strategies, Strategy, i).match_action, StrategyMatchAction, j).condition);
|
||||
g_array_free(g_array_index(strategies, Strategy, i).match_action, TRUE);
|
||||
}
|
||||
|
||||
g_array_free(strategies, TRUE);
|
||||
}
|
||||
|
@ -125,4 +125,7 @@ free_names(gboolean reset);
|
||||
void
|
||||
free_mmatches(GArray **mmatches, gboolean reset);
|
||||
|
||||
void
|
||||
free_strategies(void);
|
||||
|
||||
#endif
|
||||
|
52
src/game.c
52
src/game.c
@ -67,14 +67,15 @@ game_get_values(const Fixture *fix, gfloat team_values[][GAME_TEAM_VALUE_END],
|
||||
(1 + const_float("float_player_boost_skill_effect") * tm[i]->boost);
|
||||
|
||||
for(j=1;j<11;j++)
|
||||
{
|
||||
team_values[i][GAME_TEAM_VALUE_ATTACK] +=
|
||||
game_get_player_contribution(player_of_idx_team(tm[i], j), GAME_TEAM_VALUE_ATTACK);
|
||||
team_values[i][GAME_TEAM_VALUE_MIDFIELD] +=
|
||||
game_get_player_contribution(player_of_idx_team(tm[i], j), GAME_TEAM_VALUE_MIDFIELD);
|
||||
team_values[i][GAME_TEAM_VALUE_DEFEND] +=
|
||||
game_get_player_contribution(player_of_idx_team(tm[i], j), GAME_TEAM_VALUE_DEFEND);
|
||||
}
|
||||
if(player_of_idx_team(tm[i], j)->cskill > 0)
|
||||
{
|
||||
team_values[i][GAME_TEAM_VALUE_ATTACK] +=
|
||||
game_get_player_contribution(player_of_idx_team(tm[i], j), GAME_TEAM_VALUE_ATTACK);
|
||||
team_values[i][GAME_TEAM_VALUE_MIDFIELD] +=
|
||||
game_get_player_contribution(player_of_idx_team(tm[i], j), GAME_TEAM_VALUE_MIDFIELD);
|
||||
team_values[i][GAME_TEAM_VALUE_DEFEND] +=
|
||||
game_get_player_contribution(player_of_idx_team(tm[i], j), GAME_TEAM_VALUE_DEFEND);
|
||||
}
|
||||
|
||||
for(j=GAME_TEAM_VALUE_DEFEND;j<GAME_TEAM_VALUE_DEFEND + 3;j++)
|
||||
team_values[i][j] *=
|
||||
@ -109,8 +110,7 @@ game_get_player_contribution(const Player *pl, gint type)
|
||||
const_float("float_player_team_weight_forward_attack")}};
|
||||
|
||||
return player_get_game_skill(pl, FALSE) *
|
||||
player_weights[pl->cpos - 1][type - GAME_TEAM_VALUE_DEFEND] *
|
||||
(1 + (gfloat)pl->streak * const_float("float_player_streak_influence_skill"));
|
||||
player_weights[pl->cpos - 1][type - GAME_TEAM_VALUE_DEFEND];
|
||||
}
|
||||
|
||||
/** Return a random attacking or defending player
|
||||
@ -153,10 +153,8 @@ game_get_player(const Team *tm, gint player_type,
|
||||
else if(player_type == GAME_PLAYER_TYPE_PENALTY)
|
||||
return game_get_penalty_taker(tm, last_penalty);
|
||||
else
|
||||
{
|
||||
g_warning("game_get_player: unknown player type %d\n", player_type);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"game_get_player: unknown player type %d\n", player_type);
|
||||
|
||||
game_get_player_probs(tm->players, probs, weights, skills);
|
||||
|
||||
@ -682,13 +680,6 @@ game_substitute_player(Team *tm, gint player_number)
|
||||
|
||||
substitute = ((Player*)g_ptr_array_index(substitutes, 0))->id;
|
||||
|
||||
player_streak_add_to_prob(
|
||||
&g_array_index(tm->players, Player, player_number),
|
||||
const_float("float_player_streak_add_sub_out"));
|
||||
|
||||
player_streak_add_to_prob((Player*)g_ptr_array_index(substitutes, 0),
|
||||
const_float("float_player_streak_add_sub_in"));
|
||||
|
||||
player_swap(tm, player_number, tm, player_id_index(tm, substitute));
|
||||
|
||||
g_ptr_array_free(substitutes, TRUE);
|
||||
@ -845,9 +836,10 @@ game_decrease_fitness(const Fixture *fix)
|
||||
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
for(j=0;j<11;j++)
|
||||
if(player_of_idx_team(fix->teams[i], j)->cskill > 0)
|
||||
player_decrease_fitness(player_of_idx_team(fix->teams[i], j));
|
||||
if(debug < 50 || team_is_user(fix->teams[i]) == -1)
|
||||
for(j=0;j<11;j++)
|
||||
if(player_of_idx_team(fix->teams[i], j)->cskill > 0)
|
||||
player_decrease_fitness(player_of_idx_team(fix->teams[i], j));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1007,13 +999,13 @@ game_post_match(Fixture *fix)
|
||||
table_update(fix);
|
||||
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
if(team_is_user(fix->teams[i]) == -1)
|
||||
team_update_cpu_team(fix->teams[i],
|
||||
(fixture_user_team_involved(fix) != -1));
|
||||
else
|
||||
/* { */
|
||||
/* if(team_is_user(fix->teams[i]) == -1) */
|
||||
/* team_update_cpu_team(fix->teams[i], */
|
||||
/* (fixture_user_team_involved(fix) != -1)); */
|
||||
/* else */
|
||||
team_update_post_match(fix->teams[i], fix);
|
||||
}
|
||||
/* } */
|
||||
|
||||
if(fix->clid < ID_CUP_START)
|
||||
return;
|
||||
|
@ -176,6 +176,20 @@ game_gui_live_game_set_hscale(const LiveGameUnit *unit, GtkHScale *hscale)
|
||||
gtk_widget_modify_bg(GTK_WIDGET(hscale), GTK_STATE_NORMAL, &color);
|
||||
}
|
||||
|
||||
/** Show the player list of the opposing team in the live game
|
||||
window. */
|
||||
void
|
||||
game_gui_live_game_show_opponent_players(void)
|
||||
{
|
||||
GtkTreeView *treeview =
|
||||
GTK_TREE_VIEW(lookup_widget(window.live, "treeview_lg_opponent"));
|
||||
gint idx = (team_is_user(((LiveGame*)statp)->fix->teams[0]) == -1);
|
||||
const Team *tm = ((LiveGame*)statp)->fix->teams[!idx];
|
||||
gint scout = user_from_team(((LiveGame*)statp)->fix->teams[idx])->scout;
|
||||
|
||||
treeview_show_player_list_team(treeview, tm, scout);
|
||||
}
|
||||
|
||||
/** Look up the widgets in the main window. */
|
||||
void
|
||||
game_gui_get_radio_items(GtkWidget **style, GtkWidget **scout,
|
||||
|
@ -41,6 +41,9 @@ game_gui_live_game_show_unit(const LiveGameUnit *unit);
|
||||
void
|
||||
game_gui_live_game_set_hscale(const LiveGameUnit *unit, GtkHScale *hscale);
|
||||
|
||||
void
|
||||
game_gui_live_game_show_opponent_players(void);
|
||||
|
||||
void
|
||||
game_gui_set_main_window_header(void);
|
||||
|
||||
|
439
src/interface.c
439
src/interface.c
@ -38,7 +38,7 @@ create_main_window (void)
|
||||
GtkWidget *menu_new;
|
||||
GtkWidget *menu_open;
|
||||
GtkWidget *menu_load_last_save;
|
||||
GtkWidget *image2107;
|
||||
GtkWidget *image2151;
|
||||
GtkWidget *menu_save;
|
||||
GtkWidget *menu_save_as;
|
||||
GtkWidget *trennlinie1;
|
||||
@ -46,35 +46,35 @@ create_main_window (void)
|
||||
GtkWidget *menu_options;
|
||||
GtkWidget *menu_options_menu;
|
||||
GtkWidget *menu_preferences;
|
||||
GtkWidget *image2108;
|
||||
GtkWidget *image2152;
|
||||
GtkWidget *trennlinie7;
|
||||
GtkWidget *menu_job_offers;
|
||||
GtkWidget *menu_live_game;
|
||||
GtkWidget *menu_overwrite;
|
||||
GtkWidget *trennlinie14;
|
||||
GtkWidget *menu_save_window_geometry;
|
||||
GtkWidget *image2109;
|
||||
GtkWidget *image2153;
|
||||
GtkWidget *menu_figures;
|
||||
GtkWidget *menu_figures_menu;
|
||||
GtkWidget *menu_fixtures_week;
|
||||
GtkWidget *image2110;
|
||||
GtkWidget *image2154;
|
||||
GtkWidget *menu_fixtures;
|
||||
GtkWidget *image2111;
|
||||
GtkWidget *image2155;
|
||||
GtkWidget *menu_tables;
|
||||
GtkWidget *image2112;
|
||||
GtkWidget *image2156;
|
||||
GtkWidget *menu_my_league_results;
|
||||
GtkWidget *image2113;
|
||||
GtkWidget *image2157;
|
||||
GtkWidget *menu_season_results;
|
||||
GtkWidget *image2114;
|
||||
GtkWidget *image2158;
|
||||
GtkWidget *trennlinie13;
|
||||
GtkWidget *menu_league_stats;
|
||||
GtkWidget *image2115;
|
||||
GtkWidget *image2159;
|
||||
GtkWidget *menu_season_history;
|
||||
GtkWidget *image2116;
|
||||
GtkWidget *image2160;
|
||||
GtkWidget *menu_team;
|
||||
GtkWidget *menu_team_menu;
|
||||
GtkWidget *menu_playing_style;
|
||||
GtkWidget *image2117;
|
||||
GtkWidget *image2161;
|
||||
GtkWidget *menu_playing_style_menu;
|
||||
GSList *menu_all_out_defend_group = NULL;
|
||||
GtkWidget *menu_all_out_defend;
|
||||
@ -83,7 +83,7 @@ create_main_window (void)
|
||||
GtkWidget *menu_attack;
|
||||
GtkWidget *menu_all_out_attack;
|
||||
GtkWidget *menu_scout;
|
||||
GtkWidget *image2118;
|
||||
GtkWidget *image2162;
|
||||
GtkWidget *menu_scout_menu;
|
||||
GSList *menu_scout_best_group = NULL;
|
||||
GtkWidget *menu_scout_best;
|
||||
@ -91,7 +91,7 @@ create_main_window (void)
|
||||
GtkWidget *menu_scout_average;
|
||||
GtkWidget *menu_scout_bad;
|
||||
GtkWidget *menu_physio;
|
||||
GtkWidget *image2119;
|
||||
GtkWidget *image2163;
|
||||
GtkWidget *menu_physio_menu;
|
||||
GSList *menu_physio_best_group = NULL;
|
||||
GtkWidget *menu_physio_best;
|
||||
@ -99,7 +99,7 @@ create_main_window (void)
|
||||
GtkWidget *menu_physio_average;
|
||||
GtkWidget *menu_physio_bad;
|
||||
GtkWidget *menu_youth_academy;
|
||||
GtkWidget *image2120;
|
||||
GtkWidget *image2164;
|
||||
GtkWidget *menu_youth_academy_menu;
|
||||
GtkWidget *menu_show_youth_academy;
|
||||
GtkWidget *youth_coach1;
|
||||
@ -119,7 +119,7 @@ create_main_window (void)
|
||||
GtkWidget *menu_recruit4;
|
||||
GtkWidget *menu_set_investment;
|
||||
GtkWidget *menu_boost;
|
||||
GtkWidget *image2121;
|
||||
GtkWidget *image2165;
|
||||
GtkWidget *menu_boost_menu;
|
||||
GSList *menu_boost_on_group = NULL;
|
||||
GtkWidget *menu_boost_on;
|
||||
@ -127,72 +127,72 @@ create_main_window (void)
|
||||
GtkWidget *menu_boost_anti;
|
||||
GtkWidget *trennlinie11;
|
||||
GtkWidget *menu_reset_players;
|
||||
GtkWidget *image2122;
|
||||
GtkWidget *image2166;
|
||||
GtkWidget *menu_custom_structure;
|
||||
GtkWidget *image2123;
|
||||
GtkWidget *image2167;
|
||||
GtkWidget *menu_rearrange_team;
|
||||
GtkWidget *image2124;
|
||||
GtkWidget *image2168;
|
||||
GtkWidget *trennlinie8;
|
||||
GtkWidget *menu_browse_teams;
|
||||
GtkWidget *image2125;
|
||||
GtkWidget *image2169;
|
||||
GtkWidget *menu_player;
|
||||
GtkWidget *menu_player_menu;
|
||||
GtkWidget *menu_show_info;
|
||||
GtkWidget *image2126;
|
||||
GtkWidget *image2170;
|
||||
GtkWidget *menu_put_on_transfer_list;
|
||||
GtkWidget *image2127;
|
||||
GtkWidget *image2171;
|
||||
GtkWidget *menu_remove_from_transfer_list;
|
||||
GtkWidget *image2128;
|
||||
GtkWidget *image2172;
|
||||
GtkWidget *menu_offer_new_contract;
|
||||
GtkWidget *image2129;
|
||||
GtkWidget *image2173;
|
||||
GtkWidget *menu_fire;
|
||||
GtkWidget *image2130;
|
||||
GtkWidget *image2174;
|
||||
GtkWidget *menu_shoots_penalties;
|
||||
GtkWidget *image2131;
|
||||
GtkWidget *image2175;
|
||||
GtkWidget *menu_move_to_youth_academy;
|
||||
GtkWidget *image2132;
|
||||
GtkWidget *image2176;
|
||||
GtkWidget *trennlinie10;
|
||||
GtkWidget *menu_browse_players;
|
||||
GtkWidget *image2133;
|
||||
GtkWidget *image2177;
|
||||
GtkWidget *menu_user;
|
||||
GtkWidget *menu_user_menu;
|
||||
GtkWidget *menu_user_show_last_match;
|
||||
GtkWidget *image2134;
|
||||
GtkWidget *image2178;
|
||||
GtkWidget *menu_user_show_last_stats;
|
||||
GtkWidget *image2135;
|
||||
GtkWidget *image2179;
|
||||
GtkWidget *menu_user_show_coming_matches;
|
||||
GtkWidget *image2136;
|
||||
GtkWidget *image2180;
|
||||
GtkWidget *memorable_matches;
|
||||
GtkWidget *image2137;
|
||||
GtkWidget *image2181;
|
||||
GtkWidget *memorable_matches_menu;
|
||||
GtkWidget *mm_add_last_match;
|
||||
GtkWidget *image2138;
|
||||
GtkWidget *image2182;
|
||||
GtkWidget *mm_manage_matches;
|
||||
GtkWidget *image2139;
|
||||
GtkWidget *image2183;
|
||||
GtkWidget *trennlinie12;
|
||||
GtkWidget *menu_user_show_history;
|
||||
GtkWidget *image2140;
|
||||
GtkWidget *image2184;
|
||||
GtkWidget *trennlinie9;
|
||||
GtkWidget *menu_next_user;
|
||||
GtkWidget *image2141;
|
||||
GtkWidget *image2185;
|
||||
GtkWidget *menu_previous_user;
|
||||
GtkWidget *image2142;
|
||||
GtkWidget *image2186;
|
||||
GtkWidget *menu_manage_users;
|
||||
GtkWidget *image2143;
|
||||
GtkWidget *image2187;
|
||||
GtkWidget *menu_finances_stadium;
|
||||
GtkWidget *menu_finances_stadium_menu;
|
||||
GtkWidget *menu_show_finances;
|
||||
GtkWidget *image2144;
|
||||
GtkWidget *image2188;
|
||||
GtkWidget *menu_show_stadium;
|
||||
GtkWidget *image2145;
|
||||
GtkWidget *image2189;
|
||||
GtkWidget *menu_help1;
|
||||
GtkWidget *menu_help1_menu;
|
||||
GtkWidget *menu_about;
|
||||
GtkWidget *image2146;
|
||||
GtkWidget *image2190;
|
||||
GtkWidget *menu_contributors;
|
||||
GtkWidget *image2147;
|
||||
GtkWidget *image2191;
|
||||
GtkWidget *menu_help;
|
||||
GtkWidget *image2148;
|
||||
GtkWidget *image2192;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *button_load;
|
||||
GtkWidget *image11;
|
||||
@ -313,9 +313,9 @@ create_main_window (void)
|
||||
GDK_l, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2107 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2107);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_load_last_save), image2107);
|
||||
image2151 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2151);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_load_last_save), image2151);
|
||||
|
||||
menu_save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
|
||||
gtk_widget_show (menu_save);
|
||||
@ -348,9 +348,9 @@ create_main_window (void)
|
||||
GDK_p, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2108 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2108);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image2108);
|
||||
image2152 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2152);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image2152);
|
||||
|
||||
trennlinie7 = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (trennlinie7);
|
||||
@ -381,9 +381,9 @@ create_main_window (void)
|
||||
gtk_container_add (GTK_CONTAINER (menu_options_menu), menu_save_window_geometry);
|
||||
gtk_tooltips_set_tip (tooltips, menu_save_window_geometry, _("Save window size, position and vertical divider"), NULL);
|
||||
|
||||
image2109 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2109);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_window_geometry), image2109);
|
||||
image2153 = create_pixmap (main_window, "menu_save_geometry.png");
|
||||
gtk_widget_show (image2153);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_window_geometry), image2153);
|
||||
|
||||
menu_figures = gtk_menu_item_new_with_mnemonic (_("F_igures"));
|
||||
gtk_widget_show (menu_figures);
|
||||
@ -399,9 +399,9 @@ create_main_window (void)
|
||||
GDK_F3, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2110 = create_pixmap (main_window, "menu_fixtures.png");
|
||||
gtk_widget_show (image2110);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fixtures_week), image2110);
|
||||
image2154 = create_pixmap (main_window, "menu_fixtures.png");
|
||||
gtk_widget_show (image2154);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fixtures_week), image2154);
|
||||
|
||||
menu_fixtures = gtk_image_menu_item_new_with_mnemonic (_("Fixtures (competitions)"));
|
||||
gtk_widget_show (menu_fixtures);
|
||||
@ -410,9 +410,9 @@ create_main_window (void)
|
||||
GDK_F4, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2111 = create_pixmap (main_window, "menu_fixtures_comp.png");
|
||||
gtk_widget_show (image2111);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fixtures), image2111);
|
||||
image2155 = create_pixmap (main_window, "menu_fixtures_comp.png");
|
||||
gtk_widget_show (image2155);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fixtures), image2155);
|
||||
|
||||
menu_tables = gtk_image_menu_item_new_with_mnemonic (_("Tables"));
|
||||
gtk_widget_show (menu_tables);
|
||||
@ -421,9 +421,9 @@ create_main_window (void)
|
||||
GDK_F5, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2112 = create_pixmap (main_window, "menu_table.png");
|
||||
gtk_widget_show (image2112);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_tables), image2112);
|
||||
image2156 = create_pixmap (main_window, "menu_table.png");
|
||||
gtk_widget_show (image2156);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_tables), image2156);
|
||||
|
||||
menu_my_league_results = gtk_image_menu_item_new_with_mnemonic (_("My league results"));
|
||||
gtk_widget_show (menu_my_league_results);
|
||||
@ -432,9 +432,9 @@ create_main_window (void)
|
||||
GDK_F6, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2113 = create_pixmap (main_window, "menu_league_results.png");
|
||||
gtk_widget_show (image2113);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_my_league_results), image2113);
|
||||
image2157 = create_pixmap (main_window, "menu_league_results.png");
|
||||
gtk_widget_show (image2157);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_my_league_results), image2157);
|
||||
|
||||
menu_season_results = gtk_image_menu_item_new_with_mnemonic (_("Season results"));
|
||||
gtk_widget_show (menu_season_results);
|
||||
@ -443,9 +443,9 @@ create_main_window (void)
|
||||
GDK_s, GDK_SHIFT_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2114 = create_pixmap (main_window, "menu_season_res.png");
|
||||
gtk_widget_show (image2114);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_season_results), image2114);
|
||||
image2158 = create_pixmap (main_window, "menu_season_res.png");
|
||||
gtk_widget_show (image2158);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_season_results), image2158);
|
||||
|
||||
trennlinie13 = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (trennlinie13);
|
||||
@ -459,9 +459,9 @@ create_main_window (void)
|
||||
GDK_s, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2115 = create_pixmap (main_window, "menu_league_stats.png");
|
||||
gtk_widget_show (image2115);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_league_stats), image2115);
|
||||
image2159 = create_pixmap (main_window, "menu_league_stats.png");
|
||||
gtk_widget_show (image2159);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_league_stats), image2159);
|
||||
|
||||
menu_season_history = gtk_image_menu_item_new_with_mnemonic (_("Season history"));
|
||||
gtk_widget_show (menu_season_history);
|
||||
@ -470,9 +470,9 @@ create_main_window (void)
|
||||
GDK_h, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2116 = create_pixmap (main_window, "menu_history.png");
|
||||
gtk_widget_show (image2116);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_season_history), image2116);
|
||||
image2160 = create_pixmap (main_window, "menu_history.png");
|
||||
gtk_widget_show (image2160);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_season_history), image2160);
|
||||
|
||||
menu_team = gtk_menu_item_new_with_mnemonic (_("_Team"));
|
||||
gtk_widget_show (menu_team);
|
||||
@ -485,9 +485,9 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_playing_style);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_playing_style);
|
||||
|
||||
image2117 = create_pixmap (main_window, "menu_style.png");
|
||||
gtk_widget_show (image2117);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_playing_style), image2117);
|
||||
image2161 = create_pixmap (main_window, "menu_style.png");
|
||||
gtk_widget_show (image2161);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_playing_style), image2161);
|
||||
|
||||
menu_playing_style_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_playing_style), menu_playing_style_menu);
|
||||
@ -496,21 +496,25 @@ create_main_window (void)
|
||||
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_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_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_defend));
|
||||
gtk_widget_show (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_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_balanced));
|
||||
gtk_widget_show (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_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_attack));
|
||||
gtk_widget_show (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_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_attack));
|
||||
@ -522,9 +526,9 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_scout);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_scout);
|
||||
|
||||
image2118 = create_pixmap (main_window, "menu_scout.png");
|
||||
gtk_widget_show (image2118);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_scout), image2118);
|
||||
image2162 = create_pixmap (main_window, "menu_scout.png");
|
||||
gtk_widget_show (image2162);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_scout), image2162);
|
||||
|
||||
menu_scout_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_scout), menu_scout_menu);
|
||||
@ -533,16 +537,19 @@ create_main_window (void)
|
||||
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_best));
|
||||
gtk_widget_show (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_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_good));
|
||||
gtk_widget_show (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_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_average));
|
||||
gtk_widget_show (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_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_bad));
|
||||
@ -554,9 +561,9 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_physio);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_physio);
|
||||
|
||||
image2119 = create_pixmap (main_window, "menu_physio.png");
|
||||
gtk_widget_show (image2119);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_physio), image2119);
|
||||
image2163 = create_pixmap (main_window, "menu_physio.png");
|
||||
gtk_widget_show (image2163);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_physio), image2163);
|
||||
|
||||
menu_physio_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_physio), menu_physio_menu);
|
||||
@ -565,16 +572,19 @@ create_main_window (void)
|
||||
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_best));
|
||||
gtk_widget_show (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_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_good));
|
||||
gtk_widget_show (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_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_average));
|
||||
gtk_widget_show (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_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_bad));
|
||||
@ -586,9 +596,9 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_youth_academy);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_youth_academy);
|
||||
|
||||
image2120 = create_pixmap (main_window, "menu_youth_academy.png");
|
||||
gtk_widget_show (image2120);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_youth_academy), image2120);
|
||||
image2164 = create_pixmap (main_window, "menu_youth_academy.png");
|
||||
gtk_widget_show (image2164);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_youth_academy), image2164);
|
||||
|
||||
menu_youth_academy_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_youth_academy), menu_youth_academy_menu);
|
||||
@ -611,16 +621,19 @@ create_main_window (void)
|
||||
menu_yc_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_yc_best));
|
||||
gtk_widget_show (menu_yc_best);
|
||||
gtk_container_add (GTK_CONTAINER (youth_coach1_menu), menu_yc_best);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_yc_best), TRUE);
|
||||
|
||||
menu_yc_good = gtk_radio_menu_item_new_with_mnemonic (menu_yc_best_group, _("Good"));
|
||||
menu_yc_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_yc_good));
|
||||
gtk_widget_show (menu_yc_good);
|
||||
gtk_container_add (GTK_CONTAINER (youth_coach1_menu), menu_yc_good);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_yc_good), TRUE);
|
||||
|
||||
menu_yc_average = gtk_radio_menu_item_new_with_mnemonic (menu_yc_best_group, _("Average"));
|
||||
menu_yc_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_yc_average));
|
||||
gtk_widget_show (menu_yc_average);
|
||||
gtk_container_add (GTK_CONTAINER (youth_coach1_menu), menu_yc_average);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_yc_average), TRUE);
|
||||
|
||||
menu_yc_bad = gtk_radio_menu_item_new_with_mnemonic (menu_yc_best_group, _("Bad"));
|
||||
menu_yc_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_yc_bad));
|
||||
@ -639,21 +652,25 @@ create_main_window (void)
|
||||
menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit0));
|
||||
gtk_widget_show (menu_recruit0);
|
||||
gtk_container_add (GTK_CONTAINER (recruiting_preference1_menu), menu_recruit0);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_recruit0), TRUE);
|
||||
|
||||
menu_recruit1 = gtk_radio_menu_item_new_with_mnemonic (menu_recruit0_group, _("Defenders"));
|
||||
menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit1));
|
||||
gtk_widget_show (menu_recruit1);
|
||||
gtk_container_add (GTK_CONTAINER (recruiting_preference1_menu), menu_recruit1);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_recruit1), TRUE);
|
||||
|
||||
menu_recruit2 = gtk_radio_menu_item_new_with_mnemonic (menu_recruit0_group, _("Midfielders"));
|
||||
menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit2));
|
||||
gtk_widget_show (menu_recruit2);
|
||||
gtk_container_add (GTK_CONTAINER (recruiting_preference1_menu), menu_recruit2);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_recruit2), TRUE);
|
||||
|
||||
menu_recruit3 = gtk_radio_menu_item_new_with_mnemonic (menu_recruit0_group, _("Forwards"));
|
||||
menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit3));
|
||||
gtk_widget_show (menu_recruit3);
|
||||
gtk_container_add (GTK_CONTAINER (recruiting_preference1_menu), menu_recruit3);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_recruit3), TRUE);
|
||||
|
||||
menu_recruit4 = gtk_radio_menu_item_new_with_mnemonic (menu_recruit0_group, _("Any"));
|
||||
menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit4));
|
||||
@ -670,9 +687,9 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_boost);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_boost);
|
||||
|
||||
image2121 = create_pixmap (main_window, "menu_boost.png");
|
||||
gtk_widget_show (image2121);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_boost), image2121);
|
||||
image2165 = create_pixmap (main_window, "menu_boost.png");
|
||||
gtk_widget_show (image2165);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_boost), image2165);
|
||||
|
||||
menu_boost_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_boost), menu_boost_menu);
|
||||
@ -681,11 +698,13 @@ create_main_window (void)
|
||||
menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_on));
|
||||
gtk_widget_show (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_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_off));
|
||||
gtk_widget_show (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_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_anti));
|
||||
@ -702,17 +721,17 @@ create_main_window (void)
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_reset_players);
|
||||
gtk_tooltips_set_tip (tooltips, menu_reset_players, _("Reset player list to the formation at the beginning of the live game pause (right click on player list)"), NULL);
|
||||
|
||||
image2122 = gtk_image_new_from_stock ("gtk-undo", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2122);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reset_players), image2122);
|
||||
image2166 = gtk_image_new_from_stock ("gtk-undo", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2166);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reset_players), image2166);
|
||||
|
||||
menu_custom_structure = gtk_image_menu_item_new_with_mnemonic (_("Enter custom structure"));
|
||||
gtk_widget_show (menu_custom_structure);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_custom_structure);
|
||||
|
||||
image2123 = create_pixmap (main_window, "menu_structure.png");
|
||||
gtk_widget_show (image2123);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_custom_structure), image2123);
|
||||
image2167 = create_pixmap (main_window, "menu_structure.png");
|
||||
gtk_widget_show (image2167);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_custom_structure), image2167);
|
||||
|
||||
menu_rearrange_team = gtk_image_menu_item_new_with_mnemonic (_("Rearrange team"));
|
||||
gtk_widget_show (menu_rearrange_team);
|
||||
@ -722,9 +741,9 @@ create_main_window (void)
|
||||
GDK_r, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2124 = create_pixmap (main_window, "menu_rearrange.png");
|
||||
gtk_widget_show (image2124);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_rearrange_team), image2124);
|
||||
image2168 = create_pixmap (main_window, "menu_rearrange.png");
|
||||
gtk_widget_show (image2168);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_rearrange_team), image2168);
|
||||
|
||||
trennlinie8 = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (trennlinie8);
|
||||
@ -735,9 +754,9 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_browse_teams);
|
||||
gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_browse_teams);
|
||||
|
||||
image2125 = create_pixmap (main_window, "menu_browse_tms.png");
|
||||
gtk_widget_show (image2125);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_browse_teams), image2125);
|
||||
image2169 = create_pixmap (main_window, "menu_browse_tms.png");
|
||||
gtk_widget_show (image2169);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_browse_teams), image2169);
|
||||
|
||||
menu_player = gtk_menu_item_new_with_mnemonic (_("_Player"));
|
||||
gtk_widget_show (menu_player);
|
||||
@ -750,57 +769,57 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_show_info);
|
||||
gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_show_info);
|
||||
|
||||
image2126 = create_pixmap (main_window, "menu_player_info.png");
|
||||
gtk_widget_show (image2126);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_info), image2126);
|
||||
image2170 = create_pixmap (main_window, "menu_player_info.png");
|
||||
gtk_widget_show (image2170);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_info), image2170);
|
||||
|
||||
menu_put_on_transfer_list = gtk_image_menu_item_new_with_mnemonic (_("Put on transfer list"));
|
||||
gtk_widget_show (menu_put_on_transfer_list);
|
||||
gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_put_on_transfer_list);
|
||||
|
||||
image2127 = create_pixmap (main_window, "menu_player_put_transfer.png");
|
||||
gtk_widget_show (image2127);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_put_on_transfer_list), image2127);
|
||||
image2171 = create_pixmap (main_window, "menu_player_put_transfer.png");
|
||||
gtk_widget_show (image2171);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_put_on_transfer_list), image2171);
|
||||
|
||||
menu_remove_from_transfer_list = gtk_image_menu_item_new_with_mnemonic (_("Remove from transfer list"));
|
||||
gtk_widget_show (menu_remove_from_transfer_list);
|
||||
gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_remove_from_transfer_list);
|
||||
|
||||
image2128 = create_pixmap (main_window, "menu_player_remove_transfer.png");
|
||||
gtk_widget_show (image2128);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_remove_from_transfer_list), image2128);
|
||||
image2172 = create_pixmap (main_window, "menu_player_remove_transfer.png");
|
||||
gtk_widget_show (image2172);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_remove_from_transfer_list), image2172);
|
||||
|
||||
menu_offer_new_contract = gtk_image_menu_item_new_with_mnemonic (_("Offer new contract"));
|
||||
gtk_widget_show (menu_offer_new_contract);
|
||||
gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_offer_new_contract);
|
||||
|
||||
image2129 = create_pixmap (main_window, "menu_player_contract.png");
|
||||
gtk_widget_show (image2129);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_offer_new_contract), image2129);
|
||||
image2173 = create_pixmap (main_window, "menu_player_contract.png");
|
||||
gtk_widget_show (image2173);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_offer_new_contract), image2173);
|
||||
|
||||
menu_fire = gtk_image_menu_item_new_with_mnemonic (_("Fire"));
|
||||
gtk_widget_show (menu_fire);
|
||||
gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_fire);
|
||||
|
||||
image2130 = create_pixmap (main_window, "menu_player_fire.png");
|
||||
gtk_widget_show (image2130);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fire), image2130);
|
||||
image2174 = create_pixmap (main_window, "menu_player_fire.png");
|
||||
gtk_widget_show (image2174);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fire), image2174);
|
||||
|
||||
menu_shoots_penalties = gtk_image_menu_item_new_with_mnemonic (_("Shoots penalties"));
|
||||
gtk_widget_show (menu_shoots_penalties);
|
||||
gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_shoots_penalties);
|
||||
|
||||
image2131 = create_pixmap (main_window, "menu_player_shoots.png");
|
||||
gtk_widget_show (image2131);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_shoots_penalties), image2131);
|
||||
image2175 = create_pixmap (main_window, "menu_player_shoots.png");
|
||||
gtk_widget_show (image2175);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_shoots_penalties), image2175);
|
||||
|
||||
menu_move_to_youth_academy = gtk_image_menu_item_new_with_mnemonic (_("Move to youth academy"));
|
||||
gtk_widget_show (menu_move_to_youth_academy);
|
||||
gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_move_to_youth_academy);
|
||||
|
||||
image2132 = create_pixmap (main_window, "menu_player_move_to_ya.png");
|
||||
gtk_widget_show (image2132);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_move_to_youth_academy), image2132);
|
||||
image2176 = create_pixmap (main_window, "menu_player_move_to_ya.png");
|
||||
gtk_widget_show (image2176);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_move_to_youth_academy), image2176);
|
||||
|
||||
trennlinie10 = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (trennlinie10);
|
||||
@ -811,9 +830,9 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_browse_players);
|
||||
gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_browse_players);
|
||||
|
||||
image2133 = create_pixmap (main_window, "menu_player_browse.png");
|
||||
gtk_widget_show (image2133);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_browse_players), image2133);
|
||||
image2177 = create_pixmap (main_window, "menu_player_browse.png");
|
||||
gtk_widget_show (image2177);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_browse_players), image2177);
|
||||
|
||||
menu_user = gtk_menu_item_new_with_mnemonic (_("_User"));
|
||||
gtk_widget_show (menu_user);
|
||||
@ -829,9 +848,9 @@ create_main_window (void)
|
||||
GDK_v, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2134 = create_pixmap (main_window, "menu_last_match.png");
|
||||
gtk_widget_show (image2134);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_last_match), image2134);
|
||||
image2178 = create_pixmap (main_window, "menu_last_match.png");
|
||||
gtk_widget_show (image2178);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_last_match), image2178);
|
||||
|
||||
menu_user_show_last_stats = gtk_image_menu_item_new_with_mnemonic (_("Show last match stats"));
|
||||
gtk_widget_show (menu_user_show_last_stats);
|
||||
@ -840,9 +859,9 @@ create_main_window (void)
|
||||
GDK_F2, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2135 = create_pixmap (main_window, "menu_match_stats.png");
|
||||
gtk_widget_show (image2135);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_last_stats), image2135);
|
||||
image2179 = create_pixmap (main_window, "menu_match_stats.png");
|
||||
gtk_widget_show (image2179);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_last_stats), image2179);
|
||||
|
||||
menu_user_show_coming_matches = gtk_image_menu_item_new_with_mnemonic (_("Show coming matches"));
|
||||
gtk_widget_show (menu_user_show_coming_matches);
|
||||
@ -851,17 +870,17 @@ create_main_window (void)
|
||||
GDK_F1, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2136 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2136);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_coming_matches), image2136);
|
||||
image2180 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2180);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_coming_matches), image2180);
|
||||
|
||||
memorable_matches = gtk_image_menu_item_new_with_mnemonic (_("Memorable matches"));
|
||||
gtk_widget_show (memorable_matches);
|
||||
gtk_container_add (GTK_CONTAINER (menu_user_menu), memorable_matches);
|
||||
|
||||
image2137 = create_pixmap (main_window, "menu_mmatches.png");
|
||||
gtk_widget_show (image2137);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (memorable_matches), image2137);
|
||||
image2181 = create_pixmap (main_window, "menu_mmatches.png");
|
||||
gtk_widget_show (image2181);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (memorable_matches), image2181);
|
||||
|
||||
memorable_matches_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (memorable_matches), memorable_matches_menu);
|
||||
@ -874,9 +893,9 @@ create_main_window (void)
|
||||
GDK_a, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2138 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2138);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mm_add_last_match), image2138);
|
||||
image2182 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2182);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mm_add_last_match), image2182);
|
||||
|
||||
mm_manage_matches = gtk_image_menu_item_new_with_mnemonic (_("Manage matches"));
|
||||
gtk_widget_show (mm_manage_matches);
|
||||
@ -886,9 +905,9 @@ create_main_window (void)
|
||||
GDK_m, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2139 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2139);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mm_manage_matches), image2139);
|
||||
image2183 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2183);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mm_manage_matches), image2183);
|
||||
|
||||
trennlinie12 = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (trennlinie12);
|
||||
@ -902,9 +921,9 @@ create_main_window (void)
|
||||
GDK_h, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2140 = create_pixmap (main_window, "menu_history.png");
|
||||
gtk_widget_show (image2140);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_history), image2140);
|
||||
image2184 = create_pixmap (main_window, "menu_history.png");
|
||||
gtk_widget_show (image2184);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_history), image2184);
|
||||
|
||||
trennlinie9 = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (trennlinie9);
|
||||
@ -918,9 +937,9 @@ create_main_window (void)
|
||||
GDK_F9, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2141 = gtk_image_new_from_stock ("gtk-media-forward", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2141);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image2141);
|
||||
image2185 = gtk_image_new_from_stock ("gtk-media-forward", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2185);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image2185);
|
||||
|
||||
menu_previous_user = gtk_image_menu_item_new_with_mnemonic (_("Previous user"));
|
||||
gtk_widget_show (menu_previous_user);
|
||||
@ -929,9 +948,9 @@ create_main_window (void)
|
||||
GDK_F8, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2142 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2142);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image2142);
|
||||
image2186 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2186);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image2186);
|
||||
|
||||
menu_manage_users = gtk_image_menu_item_new_with_mnemonic (_("Manage users"));
|
||||
gtk_widget_show (menu_manage_users);
|
||||
@ -940,9 +959,9 @@ create_main_window (void)
|
||||
GDK_F12, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2143 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2143);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image2143);
|
||||
image2187 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2187);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image2187);
|
||||
|
||||
menu_finances_stadium = gtk_menu_item_new_with_mnemonic (_("Fin_Stad"));
|
||||
gtk_widget_show (menu_finances_stadium);
|
||||
@ -958,9 +977,9 @@ create_main_window (void)
|
||||
GDK_f, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2144 = create_pixmap (main_window, "menu_finances.png");
|
||||
gtk_widget_show (image2144);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_finances), image2144);
|
||||
image2188 = create_pixmap (main_window, "menu_finances.png");
|
||||
gtk_widget_show (image2188);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_finances), image2188);
|
||||
|
||||
menu_show_stadium = gtk_image_menu_item_new_with_mnemonic (_("Show stadium"));
|
||||
gtk_widget_show (menu_show_stadium);
|
||||
@ -969,9 +988,9 @@ create_main_window (void)
|
||||
GDK_f, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image2145 = create_pixmap (main_window, "menu_stadium.png");
|
||||
gtk_widget_show (image2145);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_stadium), image2145);
|
||||
image2189 = create_pixmap (main_window, "menu_stadium.png");
|
||||
gtk_widget_show (image2189);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_stadium), image2189);
|
||||
|
||||
menu_help1 = gtk_menu_item_new_with_mnemonic (_("_Help"));
|
||||
gtk_widget_show (menu_help1);
|
||||
@ -984,25 +1003,25 @@ create_main_window (void)
|
||||
gtk_widget_show (menu_about);
|
||||
gtk_container_add (GTK_CONTAINER (menu_help1_menu), menu_about);
|
||||
|
||||
image2146 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2146);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_about), image2146);
|
||||
image2190 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2190);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_about), image2190);
|
||||
|
||||
menu_contributors = gtk_image_menu_item_new_with_mnemonic (_("Contributors"));
|
||||
gtk_widget_show (menu_contributors);
|
||||
gtk_container_add (GTK_CONTAINER (menu_help1_menu), menu_contributors);
|
||||
|
||||
image2147 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2147);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_contributors), image2147);
|
||||
image2191 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2191);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_contributors), image2191);
|
||||
|
||||
menu_help = gtk_image_menu_item_new_with_mnemonic (_("Help"));
|
||||
gtk_widget_show (menu_help);
|
||||
gtk_container_add (GTK_CONTAINER (menu_help1_menu), menu_help);
|
||||
|
||||
image2148 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2148);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_help), image2148);
|
||||
image2192 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image2192);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_help), image2192);
|
||||
|
||||
hbox1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
@ -1646,7 +1665,7 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_new, "menu_new");
|
||||
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, image2107, "image2107");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2151, "image2151");
|
||||
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, trennlinie1, "trennlinie1");
|
||||
@ -1654,35 +1673,35 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_options, "menu_options");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_options_menu, "menu_options_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_preferences, "menu_preferences");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2108, "image2108");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2152, "image2152");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie7, "trennlinie7");
|
||||
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_overwrite, "menu_overwrite");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie14, "trennlinie14");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_save_window_geometry, "menu_save_window_geometry");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2109, "image2109");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2153, "image2153");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_figures, "menu_figures");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_figures_menu, "menu_figures_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_fixtures_week, "menu_fixtures_week");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2110, "image2110");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2154, "image2154");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_fixtures, "menu_fixtures");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2111, "image2111");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2155, "image2155");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_tables, "menu_tables");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2112, "image2112");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2156, "image2156");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_my_league_results, "menu_my_league_results");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2113, "image2113");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2157, "image2157");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_season_results, "menu_season_results");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2114, "image2114");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2158, "image2158");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie13, "trennlinie13");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_league_stats, "menu_league_stats");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2115, "image2115");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2159, "image2159");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_season_history, "menu_season_history");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2116, "image2116");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2160, "image2160");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_team, "menu_team");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_team_menu, "menu_team_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_playing_style, "menu_playing_style");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2117, "image2117");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2161, "image2161");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_playing_style_menu, "menu_playing_style_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_all_out_defend, "menu_all_out_defend");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_defend, "menu_defend");
|
||||
@ -1690,21 +1709,21 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_attack, "menu_attack");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_all_out_attack, "menu_all_out_attack");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_scout, "menu_scout");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2118, "image2118");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2162, "image2162");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_scout_menu, "menu_scout_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_scout_best, "menu_scout_best");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_scout_good, "menu_scout_good");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_scout_average, "menu_scout_average");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_scout_bad, "menu_scout_bad");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_physio, "menu_physio");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2119, "image2119");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2163, "image2163");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_physio_menu, "menu_physio_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_physio_best, "menu_physio_best");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_physio_good, "menu_physio_good");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_physio_average, "menu_physio_average");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_physio_bad, "menu_physio_bad");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_youth_academy, "menu_youth_academy");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2120, "image2120");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2164, "image2164");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_youth_academy_menu, "menu_youth_academy_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_show_youth_academy, "menu_show_youth_academy");
|
||||
GLADE_HOOKUP_OBJECT (main_window, youth_coach1, "youth_coach1");
|
||||
@ -1722,79 +1741,79 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_recruit4, "menu_recruit4");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_set_investment, "menu_set_investment");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_boost, "menu_boost");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2121, "image2121");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2165, "image2165");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_boost_menu, "menu_boost_menu");
|
||||
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_anti, "menu_boost_anti");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie11, "trennlinie11");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_reset_players, "menu_reset_players");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2122, "image2122");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2166, "image2166");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_custom_structure, "menu_custom_structure");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2123, "image2123");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2167, "image2167");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_rearrange_team, "menu_rearrange_team");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2124, "image2124");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2168, "image2168");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie8, "trennlinie8");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_browse_teams, "menu_browse_teams");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2125, "image2125");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2169, "image2169");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_player, "menu_player");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_player_menu, "menu_player_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_show_info, "menu_show_info");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2126, "image2126");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2170, "image2170");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_put_on_transfer_list, "menu_put_on_transfer_list");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2127, "image2127");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2171, "image2171");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_remove_from_transfer_list, "menu_remove_from_transfer_list");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2128, "image2128");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2172, "image2172");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_offer_new_contract, "menu_offer_new_contract");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2129, "image2129");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2173, "image2173");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_fire, "menu_fire");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2130, "image2130");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2174, "image2174");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_shoots_penalties, "menu_shoots_penalties");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2131, "image2131");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2175, "image2175");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_move_to_youth_academy, "menu_move_to_youth_academy");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2132, "image2132");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2176, "image2176");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie10, "trennlinie10");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_browse_players, "menu_browse_players");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2133, "image2133");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2177, "image2177");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_user, "menu_user");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_user_menu, "menu_user_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_user_show_last_match, "menu_user_show_last_match");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2134, "image2134");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2178, "image2178");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_user_show_last_stats, "menu_user_show_last_stats");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2135, "image2135");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2179, "image2179");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_user_show_coming_matches, "menu_user_show_coming_matches");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2136, "image2136");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2180, "image2180");
|
||||
GLADE_HOOKUP_OBJECT (main_window, memorable_matches, "memorable_matches");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2137, "image2137");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2181, "image2181");
|
||||
GLADE_HOOKUP_OBJECT (main_window, memorable_matches_menu, "memorable_matches_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, mm_add_last_match, "mm_add_last_match");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2138, "image2138");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2182, "image2182");
|
||||
GLADE_HOOKUP_OBJECT (main_window, mm_manage_matches, "mm_manage_matches");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2139, "image2139");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2183, "image2183");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie12, "trennlinie12");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_user_show_history, "menu_user_show_history");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2140, "image2140");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2184, "image2184");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie9, "trennlinie9");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_next_user, "menu_next_user");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2141, "image2141");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2185, "image2185");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_previous_user, "menu_previous_user");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2142, "image2142");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2186, "image2186");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_manage_users, "menu_manage_users");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2143, "image2143");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2187, "image2187");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium, "menu_finances_stadium");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium_menu, "menu_finances_stadium_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_show_finances, "menu_show_finances");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2144, "image2144");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2188, "image2188");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_show_stadium, "menu_show_stadium");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2145, "image2145");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2189, "image2189");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_help1, "menu_help1");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_help1_menu, "menu_help1_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_about, "menu_about");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2146, "image2146");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2190, "image2190");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_contributors, "menu_contributors");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2147, "image2147");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2191, "image2191");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_help, "menu_help");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2148, "image2148");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image2192, "image2192");
|
||||
GLADE_HOOKUP_OBJECT (main_window, hbox1, "hbox1");
|
||||
GLADE_HOOKUP_OBJECT (main_window, button_load, "button_load");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image11, "image11");
|
||||
|
34
src/league.c
34
src/league.c
@ -125,10 +125,9 @@ league_cup_get_index_from_clid(gint clid)
|
||||
}
|
||||
|
||||
if(index == -1)
|
||||
{
|
||||
g_warning("league_cup_get_index_from_clid: couldn't find league or cup with id %d\n", clid);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"league_cup_get_index_from_clid: couldn't find league or cup with id %d\n",
|
||||
clid);
|
||||
|
||||
return index;
|
||||
}
|
||||
@ -145,9 +144,9 @@ league_from_clid(gint clid)
|
||||
if(lig(i).id == clid)
|
||||
return &lig(i);
|
||||
|
||||
g_warning("league_from_clid: didn't find league with id %d\n", clid);
|
||||
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"league_from_clid: didn't find league with id %d\n",
|
||||
clid);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -337,9 +336,8 @@ league_index_from_sid(const gchar *sid)
|
||||
if(strcmp(lig(i).sid, sid) == 0)
|
||||
return i;
|
||||
|
||||
g_warning("league_index_from_sid: no index found for sid '%s'.\n", sid);
|
||||
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"league_index_from_sid: no index found for sid '%s'.\n", sid);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -693,11 +691,9 @@ league_team_movements_assign_dest(GArray *team_movements, gint idx,
|
||||
league_cur_size[dest_idx]++;
|
||||
|
||||
if(league_cur_size[dest_idx] > league_size[dest_idx])
|
||||
{
|
||||
g_warning("league_team_movements_assign_dest: no room in league %s for team %s.",
|
||||
lig(dest_idx).name, tmove->tm.name);
|
||||
main_exit_program(EXIT_PROM_REL, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_PROM_REL,
|
||||
"league_team_movements_assign_dest: no room in league %s for team %s.",
|
||||
lig(dest_idx).name, tmove->tm.name);
|
||||
|
||||
tmove->dest_assigned = TRUE;
|
||||
|
||||
@ -717,11 +713,9 @@ league_team_movements_assign_dest(GArray *team_movements, gint idx,
|
||||
g_array_remove_index(tmove->dest_idcs, j);
|
||||
|
||||
if(tmove->dest_idcs->len == 0)
|
||||
{
|
||||
g_warning("league_team_movements_assign_dest: no destinations left for team %s.",
|
||||
tmove->tm.name);
|
||||
main_exit_program(EXIT_PROM_REL, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_PROM_REL,
|
||||
"league_team_movements_assign_dest: no destinations left for team %s.",
|
||||
tmove->tm.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "xml_lg_commentary.h"
|
||||
|
||||
/** The replacement strings for the live game commentary tokens. */
|
||||
gchar **token_rep;
|
||||
GPtrArray *token_rep[2];
|
||||
/** Whether there was a commentary repetition rejection. */
|
||||
gboolean repetition;
|
||||
|
||||
@ -100,16 +100,16 @@ lg_commentary_generate(const LiveGame *live_game, LiveGameUnit *unit)
|
||||
unit->event.commentary_id = (i == (*commentaries)->len) ?
|
||||
-1 : g_array_index(*commentaries, LGCommentary, order[i]).id;
|
||||
|
||||
for(i=0;i<lg_tokens.list->len;i++)
|
||||
if(i != option_int("string_lg_commentary_token_team_home", &lg_tokens) &&
|
||||
i != option_int("string_lg_commentary_token_team_away", &lg_tokens) &&
|
||||
i != option_int("string_lg_commentary_token_attendance", &lg_tokens) &&
|
||||
i != option_int("string_lg_commentary_token_cup_round_name", &lg_tokens) &&
|
||||
i != option_int("string_lg_commentary_token_league_cup_name", &lg_tokens) &&
|
||||
i != option_int("string_lg_commentary_token_yellow_limit", &lg_tokens) &&
|
||||
i != option_int("string_lg_commentary_token_team_layer0", &lg_tokens) &&
|
||||
i != option_int("string_lg_commentary_token_team_layer1", &lg_tokens))
|
||||
free_gchar_ptr(token_rep[i]);
|
||||
for(i=0;i<tokens.list->len;i++)
|
||||
if(i != option_int("string_token_team_home", &tokens) &&
|
||||
i != option_int("string_token_team_away", &tokens) &&
|
||||
i != option_int("string_token_attendance", &tokens) &&
|
||||
i != option_int("string_token_cup_round_name", &tokens) &&
|
||||
i != option_int("string_token_league_cup_name", &tokens) &&
|
||||
i != option_int("string_token_yellow_limit", &tokens) &&
|
||||
i != option_int("string_token_team_layer0", &tokens) &&
|
||||
i != option_int("string_token_team_layer1", &tokens))
|
||||
misc_token_remove(token_rep, i);
|
||||
}
|
||||
|
||||
/** Check whether the commentary conditions are fulfilled and whether
|
||||
@ -121,7 +121,7 @@ lg_commentary_check_commentary(const LGCommentary *commentary, gchar *dest)
|
||||
|
||||
if(strlen(commentary->text) == 0 ||
|
||||
(commentary->condition != NULL &&
|
||||
!lg_commentary_parse_condition(commentary->condition)) ||
|
||||
!misc_parse_condition(commentary->condition, token_rep)) ||
|
||||
(repetition == FALSE && query_lg_commentary_is_repetition(commentary->id)))
|
||||
return FALSE;
|
||||
|
||||
@ -130,14 +130,12 @@ lg_commentary_check_commentary(const LGCommentary *commentary, gchar *dest)
|
||||
do
|
||||
{
|
||||
strcpy(buf, dest);
|
||||
if(!lg_commentary_replace_tokens(dest))
|
||||
return FALSE;
|
||||
|
||||
lg_commentary_replace_expressions(dest);
|
||||
misc_string_replace_tokens(dest, token_rep);
|
||||
misc_string_replace_expressions(dest);
|
||||
}
|
||||
while(strcmp(buf, dest) != 0);
|
||||
|
||||
return TRUE;
|
||||
return (g_strrstr(dest, "_") == NULL);
|
||||
}
|
||||
|
||||
/** Check whether a commentary with given id has been used in the last
|
||||
@ -156,159 +154,6 @@ query_lg_commentary_is_repetition(gint id)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Choose one of strings separated with '|' */
|
||||
void lg_commentary_choose_random(gchar* s)
|
||||
{
|
||||
const gchar STR_SEP = '|';
|
||||
gint i = 0;
|
||||
gint count = 1;
|
||||
const gchar* start;
|
||||
|
||||
for (i = 0; s[i]; i++)
|
||||
count += (s[i] == STR_SEP);
|
||||
|
||||
if (count == 1)
|
||||
return;
|
||||
|
||||
count = math_rndi(0, count-1) + 1;
|
||||
start = s;
|
||||
for (i = 0; s[i]; i++)
|
||||
if (s[i] == STR_SEP)
|
||||
{
|
||||
count--;
|
||||
if (count == 1)
|
||||
start = s + i + 1;
|
||||
else if (!count)
|
||||
{
|
||||
s[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(s, start);
|
||||
}
|
||||
|
||||
/** Replace simple arithmetic expressions like "1 + 2"
|
||||
and comparisons like "3 < 4" with the appropriate result. */
|
||||
void
|
||||
lg_commentary_replace_expressions(gchar *commentary_text)
|
||||
{
|
||||
gint i, j, last_idx = 0;
|
||||
gint value = -1;
|
||||
gchar buf[SMALL], buf2[SMALL];
|
||||
|
||||
if(debug > 100)
|
||||
printf("lg_commentary_replace_expressions: #%s#\n",
|
||||
commentary_text);
|
||||
|
||||
if(!g_strrstr(commentary_text, "["))
|
||||
return;
|
||||
|
||||
strcpy(buf, commentary_text);
|
||||
strcpy(commentary_text, "");
|
||||
|
||||
for(i=strlen(buf) - 1; i>=0; i--)
|
||||
if(buf[i] == '[')
|
||||
{
|
||||
strncpy(buf2, buf, i);
|
||||
buf2[i] = '\0';
|
||||
strcat(commentary_text, buf2);
|
||||
|
||||
for(j=i + 1;j<strlen(buf);j++)
|
||||
{
|
||||
if(buf[j] == ']')
|
||||
{
|
||||
strncpy(buf2, buf + i + 1, j - i - 1);
|
||||
buf2[j - i - 1] = '\0';
|
||||
if (g_strrstr(buf2, "|"))
|
||||
lg_commentary_choose_random(buf2);
|
||||
else
|
||||
{
|
||||
if(g_strrstr(buf2, "<") ||
|
||||
g_strrstr(buf2, ">") ||
|
||||
g_strrstr(buf2, "=") ||
|
||||
g_strrstr(buf2, " G ") ||
|
||||
g_strrstr(buf2, " L ") ||
|
||||
g_strrstr(buf2, " GE ") ||
|
||||
g_strrstr(buf2, " LE "))
|
||||
misc_parse(buf2, &value);
|
||||
else
|
||||
misc_parse_expression(buf2, &value);
|
||||
sprintf(buf2, "%d", value);
|
||||
}
|
||||
strcat(commentary_text, buf2);
|
||||
value = -1;
|
||||
|
||||
last_idx = j + 1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(last_idx < strlen(buf))
|
||||
{
|
||||
strncpy(buf2, buf + last_idx, strlen(buf) - last_idx);
|
||||
buf2[strlen(buf) - last_idx] = '\0';
|
||||
strcat(commentary_text, buf2);
|
||||
}
|
||||
}
|
||||
|
||||
/** Try to replace all special tokens in the string and write the result to dest.
|
||||
@param commentary The commentary with tokens.
|
||||
@param dest The destination string.
|
||||
@return TRUE if we could replace all tokens and the commentary condition
|
||||
was fulfilled, FALSE otherwise. */
|
||||
gboolean
|
||||
lg_commentary_replace_tokens(gchar *commentary_text)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<lg_tokens.list->len;i++)
|
||||
{
|
||||
if(g_strrstr(commentary_text,
|
||||
g_array_index(lg_tokens.list, Option, i).string_value))
|
||||
{
|
||||
if(token_rep[i] == NULL)
|
||||
return FALSE;
|
||||
else
|
||||
misc_string_replace_token(commentary_text,
|
||||
g_array_index(lg_tokens.list, Option, i).string_value,
|
||||
token_rep[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Find out whether the conditions of the commentary are fulfilled. */
|
||||
gboolean
|
||||
lg_commentary_parse_condition(const gchar *condition)
|
||||
{
|
||||
gboolean return_value = FALSE;
|
||||
gchar buf[SMALL], buf2[SMALL];
|
||||
|
||||
strcpy(buf, condition);
|
||||
|
||||
do
|
||||
{
|
||||
strcpy(buf2, buf);
|
||||
if(!lg_commentary_replace_tokens(buf))
|
||||
return FALSE;
|
||||
|
||||
lg_commentary_replace_expressions(buf);
|
||||
}
|
||||
while(strcmp(buf2, buf) != 0);
|
||||
|
||||
misc_parse(buf, &return_value);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Write a random order of indices into the integer array
|
||||
(only depending on the priority values of the commentaries).
|
||||
I don't like this implementation of ordering the commentaries
|
||||
@ -355,43 +200,61 @@ lg_commentary_get_order(const GArray *commentaries, gint *order)
|
||||
void
|
||||
lg_commentary_set_stats_tokens(const LiveGameStats *stats)
|
||||
{
|
||||
token_rep[option_int("string_lg_commentary_token_stat_shots0", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_SHOTS]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_shot_per0", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_SHOT_PERCENTAGE]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_poss0", &lg_tokens)] =
|
||||
misc_int_to_char((gint)rint(100 * ((gfloat)stats->values[0][LIVE_GAME_STAT_VALUE_POSSESSION] /
|
||||
((gfloat)stats->values[0][LIVE_GAME_STAT_VALUE_POSSESSION] +
|
||||
(gfloat)stats->values[1][LIVE_GAME_STAT_VALUE_POSSESSION]))));
|
||||
token_rep[option_int("string_lg_commentary_token_stat_pen0", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_PENALTIES]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_fouls0", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_FOULS]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_yellows0", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_CARDS]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_reds0", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_REDS]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_injs0", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_INJURIES]);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_shots0", &tokens),
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_SHOTS]));
|
||||
|
||||
token_rep[option_int("string_lg_commentary_token_stat_shots1", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_SHOTS]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_shot_per1", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_SHOT_PERCENTAGE]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_poss1", &lg_tokens)] =
|
||||
misc_int_to_char((gint)rint(100 * ((gfloat)stats->values[1][LIVE_GAME_STAT_VALUE_POSSESSION] /
|
||||
((gfloat)stats->values[0][LIVE_GAME_STAT_VALUE_POSSESSION] +
|
||||
(gfloat)stats->values[1][LIVE_GAME_STAT_VALUE_POSSESSION]))));
|
||||
token_rep[option_int("string_lg_commentary_token_stat_pen1", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_PENALTIES]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_fouls1", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_FOULS]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_yellows1", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_CARDS]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_reds1", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_REDS]);
|
||||
token_rep[option_int("string_lg_commentary_token_stat_injs1", &lg_tokens)] =
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_INJURIES]);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_shot_per0", &tokens),
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_SHOT_PERCENTAGE]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_poss0", &tokens),
|
||||
misc_int_to_char((gint)rint(100 *
|
||||
((gfloat)stats->values[0][LIVE_GAME_STAT_VALUE_POSSESSION] /
|
||||
((gfloat)stats->values[0][LIVE_GAME_STAT_VALUE_POSSESSION] +
|
||||
(gfloat)stats->values[1][LIVE_GAME_STAT_VALUE_POSSESSION])))));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_pen0", &tokens),
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_PENALTIES]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_fouls0", &tokens),
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_FOULS]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_yellows0", &tokens),
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_CARDS]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_reds0", &tokens),
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_REDS]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_injs0", &tokens),
|
||||
misc_int_to_char(stats->values[0][LIVE_GAME_STAT_VALUE_INJURIES]));
|
||||
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_shots1", &tokens),
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_SHOTS]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_shot_per1", &tokens),
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_SHOT_PERCENTAGE]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_poss1", &tokens),
|
||||
misc_int_to_char((gint)rint(100 * ((gfloat)stats->values[1][LIVE_GAME_STAT_VALUE_POSSESSION] /
|
||||
((gfloat)stats->values[0][LIVE_GAME_STAT_VALUE_POSSESSION] +
|
||||
(gfloat)stats->values[1][LIVE_GAME_STAT_VALUE_POSSESSION])))));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_pen1", &tokens),
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_PENALTIES]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_fouls1", &tokens),
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_FOULS]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_yellows1", &tokens),
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_CARDS]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_reds1", &tokens),
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_REDS]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_stat_injs1", &tokens),
|
||||
misc_int_to_char(stats->values[1][LIVE_GAME_STAT_VALUE_INJURIES]));
|
||||
}
|
||||
|
||||
/** Fill the tokens that contain general information. */
|
||||
@ -404,19 +267,23 @@ lg_commentary_set_basic_tokens(const LiveGameUnit *unit, const Fixture *fix)
|
||||
avskill1 = (gint)rint(team_get_average_skill(fix->teams[1], TRUE));
|
||||
|
||||
sprintf(buf, "%d : %d", unit->result[0], unit->result[1]);
|
||||
token_rep[option_int("string_lg_commentary_token_result", &lg_tokens)] =
|
||||
g_strdup(buf);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_result", &tokens),
|
||||
g_strdup(buf));
|
||||
|
||||
token_rep[option_int("string_lg_commentary_token_time", &lg_tokens)] =
|
||||
misc_int_to_char(unit->time);
|
||||
token_rep[option_int("string_lg_commentary_token_minute", &lg_tokens)] =
|
||||
misc_int_to_char(live_game_unit_get_minute(unit));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_time", &tokens),
|
||||
misc_int_to_char(unit->time));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_minute", &tokens),
|
||||
misc_int_to_char(current_min));
|
||||
|
||||
tmp_int = live_game_get_minutes_remaining(unit);
|
||||
|
||||
if(tmp_int > 0)
|
||||
token_rep[option_int("string_lg_commentary_token_minute_remaining", &lg_tokens)] =
|
||||
misc_int_to_char(tmp_int);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_minute_remaining", &tokens),
|
||||
misc_int_to_char(tmp_int));
|
||||
|
||||
if(query_fixture_is_draw(fix))
|
||||
tmp_int = 120 - current_min;
|
||||
@ -424,29 +291,39 @@ lg_commentary_set_basic_tokens(const LiveGameUnit *unit, const Fixture *fix)
|
||||
tmp_int = 90 - current_min;
|
||||
|
||||
if(tmp_int > 0)
|
||||
token_rep[option_int("string_lg_commentary_token_minute_total", &lg_tokens)] =
|
||||
misc_int_to_char(tmp_int);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_minute_total", &tokens),
|
||||
misc_int_to_char(tmp_int));
|
||||
|
||||
token_rep[option_int("string_lg_commentary_token_goals0", &lg_tokens)] =
|
||||
misc_int_to_char(unit->result[0]);
|
||||
token_rep[option_int("string_lg_commentary_token_goals1", &lg_tokens)] =
|
||||
misc_int_to_char(unit->result[1]);
|
||||
token_rep[option_int("string_lg_commentary_token_goal_diff", &lg_tokens)] =
|
||||
misc_int_to_char(ABS(unit->result[0] - unit->result[1]));
|
||||
token_rep[option_int("string_lg_commentary_token_extra", &lg_tokens)] =
|
||||
lg_commentary_get_extra_data(unit, fix);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_goals0", &tokens),
|
||||
misc_int_to_char(unit->result[0]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_goals1", &tokens),
|
||||
misc_int_to_char(unit->result[1]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_goal_diff", &tokens),
|
||||
misc_int_to_char(ABS(unit->result[0] - unit->result[1])));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_extra", &tokens),
|
||||
lg_commentary_get_extra_data(unit, fix));
|
||||
|
||||
token_rep[option_int("string_lg_commentary_token_possession", &lg_tokens)] =
|
||||
misc_int_to_char(unit->possession);
|
||||
token_rep[option_int("string_lg_commentary_token_no_possession", &lg_tokens)] =
|
||||
misc_int_to_char(!unit->possession);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_possession", &tokens),
|
||||
misc_int_to_char(unit->possession));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_no_possession", &tokens),
|
||||
misc_int_to_char(!unit->possession));
|
||||
|
||||
token_rep[option_int("string_lg_commentary_token_team_avskill0", &lg_tokens)] =
|
||||
misc_int_to_char(avskill0);
|
||||
token_rep[option_int("string_lg_commentary_token_team_avskill1", &lg_tokens)] =
|
||||
misc_int_to_char(avskill1);
|
||||
token_rep[option_int("string_lg_commentary_token_team_avskilldiff", &lg_tokens)] =
|
||||
misc_int_to_char(ABS(avskill0 - avskill1));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_avskill0", &tokens),
|
||||
misc_int_to_char(avskill0));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_avskill1", &tokens),
|
||||
misc_int_to_char(avskill1));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_avskilldiff", &tokens),
|
||||
misc_int_to_char(ABS(avskill0 - avskill1)));
|
||||
}
|
||||
|
||||
/** Set the tokens containing team data. */
|
||||
@ -455,19 +332,24 @@ lg_commentary_set_team_tokens(const LiveGameUnit *unit, const Fixture *fix)
|
||||
{
|
||||
if(unit->result[0] != unit->result[1])
|
||||
{
|
||||
token_rep[option_int("string_lg_commentary_token_team_losing", &lg_tokens)] =
|
||||
g_strdup(fix->teams[(unit->result[0] > unit->result[1])]->name);
|
||||
token_rep[option_int("string_lg_commentary_token_team_winning", &lg_tokens)] =
|
||||
g_strdup(fix->teams[(unit->result[0] < unit->result[1])]->name);
|
||||
token_rep[option_int("string_lg_commentary_token_team_losingn", &lg_tokens)] =
|
||||
misc_int_to_char((unit->result[0] > unit->result[1]));
|
||||
token_rep[option_int("string_lg_commentary_token_team_winningn", &lg_tokens)] =
|
||||
misc_int_to_char((unit->result[0] < unit->result[1]));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_losing", &tokens),
|
||||
g_strdup(fix->teams[(unit->result[0] > unit->result[1])]->name));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_winning", &tokens),
|
||||
g_strdup(fix->teams[(unit->result[0] < unit->result[1])]->name));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_losingn", &tokens),
|
||||
misc_int_to_char((unit->result[0] > unit->result[1])));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_winningn", &tokens),
|
||||
misc_int_to_char((unit->result[0] < unit->result[1])));
|
||||
}
|
||||
|
||||
if(unit->event.team != -1)
|
||||
token_rep[option_int("string_lg_commentary_token_team", &lg_tokens)] =
|
||||
misc_int_to_char(unit->event.team);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team", &tokens),
|
||||
misc_int_to_char(unit->event.team));
|
||||
}
|
||||
|
||||
/** Set the player tokens. */
|
||||
@ -529,24 +411,31 @@ lg_commentary_set_player_tokens(const LiveGameUnit *unit, const Fixture *fix)
|
||||
|
||||
if(pl1 != NULL)
|
||||
{
|
||||
token_rep[option_int("string_lg_commentary_token_player0", &lg_tokens)] =
|
||||
player_get_last_name(pl1->name);
|
||||
token_rep[option_int("string_lg_commentary_token_player_goals0", &lg_tokens)] =
|
||||
misc_int_to_char(player_games_goals_get(pl1, fix->clid, PLAYER_VALUE_GOALS));
|
||||
token_rep[option_int("string_lg_commentary_token_player_goals_all0", &lg_tokens)] =
|
||||
misc_int_to_char(player_all_games_goals(pl1, PLAYER_VALUE_GOALS));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_player0", &tokens),
|
||||
player_get_last_name(pl1->name));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_player_goals0", &tokens),
|
||||
misc_int_to_char(player_games_goals_get(pl1, fix->clid, PLAYER_VALUE_GOALS)));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_player_goals_all0", &tokens),
|
||||
misc_int_to_char(player_all_games_goals(pl1, PLAYER_VALUE_GOALS)));
|
||||
}
|
||||
|
||||
if(pl2 != NULL)
|
||||
{
|
||||
token_rep[option_int("string_lg_commentary_token_player1", &lg_tokens)] =
|
||||
player_get_last_name(pl2->name);
|
||||
token_rep[option_int("string_lg_commentary_token_player_goals1", &lg_tokens)] =
|
||||
misc_int_to_char(player_games_goals_get(pl2, fix->clid, PLAYER_VALUE_GOALS));
|
||||
token_rep[option_int("string_lg_commentary_token_player_goals_all1", &lg_tokens)] =
|
||||
misc_int_to_char(player_all_games_goals(pl2, PLAYER_VALUE_GOALS));
|
||||
token_rep[option_int("string_lg_commentary_token_player_yellows", &lg_tokens)] =
|
||||
misc_int_to_char(player_card_get(pl2, fix->clid, PLAYER_VALUE_CARD_YELLOW));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_player1", &tokens),
|
||||
player_get_last_name(pl2->name));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_player_goals1", &tokens),
|
||||
misc_int_to_char(player_games_goals_get(pl2, fix->clid, PLAYER_VALUE_GOALS)));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_player_goals_all1", &tokens),
|
||||
misc_int_to_char(player_all_games_goals(pl2, PLAYER_VALUE_GOALS)));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_player_yellows", &tokens),
|
||||
misc_int_to_char(player_card_get(pl2, fix->clid, PLAYER_VALUE_CARD_YELLOW)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,58 +488,70 @@ lg_commentary_get_extra_data(const LiveGameUnit *unit, const Fixture *fix)
|
||||
void
|
||||
lg_commentary_initialize(const Fixture *fix)
|
||||
{
|
||||
gint i;
|
||||
gchar buf[SMALL];
|
||||
|
||||
token_rep = (gchar**)g_malloc(sizeof(gchar*) * lg_tokens.list->len);
|
||||
token_rep[0] = g_ptr_array_new();
|
||||
token_rep[1] = g_ptr_array_new();
|
||||
|
||||
for(i=0;i<lg_tokens.list->len;i++)
|
||||
token_rep[i] = NULL;
|
||||
|
||||
token_rep[option_int("string_lg_commentary_token_team_home", &lg_tokens)] =
|
||||
g_strdup(fix->teams[0]->name);
|
||||
token_rep[option_int("string_lg_commentary_token_team_away", &lg_tokens)] =
|
||||
g_strdup(fix->teams[1]->name);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_home", &tokens),
|
||||
g_strdup(fix->teams[0]->name));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_away", &tokens),
|
||||
g_strdup(fix->teams[1]->name));
|
||||
|
||||
if(fix->teams[0]->clid < ID_CUP_START)
|
||||
token_rep[option_int("string_lg_commentary_token_team_layer0", &lg_tokens)] =
|
||||
misc_int_to_char(league_from_clid(fix->teams[0]->clid)->layer);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_layer0", &tokens),
|
||||
misc_int_to_char(league_from_clid(fix->teams[0]->clid)->layer));
|
||||
if(fix->teams[1]->clid < ID_CUP_START)
|
||||
token_rep[option_int("string_lg_commentary_token_team_layer1", &lg_tokens)] =
|
||||
misc_int_to_char(league_from_clid(fix->teams[1]->clid)->layer);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_layer1", &tokens),
|
||||
misc_int_to_char(league_from_clid(fix->teams[1]->clid)->layer));
|
||||
|
||||
token_rep[option_int("string_lg_commentary_token_league_cup_name", &lg_tokens)] =
|
||||
g_strdup(league_cup_get_name_string(fix->clid));
|
||||
if(fix->teams[0]->clid < ID_CUP_START &&
|
||||
fix->teams[1]->clid < ID_CUP_START)
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_team_layerdiff", &tokens),
|
||||
misc_int_to_char(league_from_clid(fix->teams[0]->clid)->layer -
|
||||
league_from_clid(fix->teams[1]->clid)->layer));
|
||||
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_league_cup_name", &tokens),
|
||||
g_strdup(league_cup_get_name_string(fix->clid)));
|
||||
|
||||
if(fix->clid >= ID_CUP_START)
|
||||
{
|
||||
cup_get_round_name(cup_from_clid(fix->clid), fix->round, buf);
|
||||
token_rep[option_int("string_lg_commentary_token_cup_round_name", &lg_tokens)] =
|
||||
g_strdup(buf);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_cup_round_name", &tokens),
|
||||
g_strdup(buf));
|
||||
}
|
||||
|
||||
misc_print_grouped_int(fix->attendance, buf);
|
||||
token_rep[option_int("string_lg_commentary_token_attendance", &lg_tokens)] =
|
||||
g_strdup(buf);
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_attendance", &tokens),
|
||||
g_strdup(buf));
|
||||
|
||||
token_rep[option_int("string_lg_commentary_token_yellow_limit", &lg_tokens)] =
|
||||
misc_int_to_char(league_cup_get_yellow_red(fix->clid));
|
||||
misc_token_add(token_rep,
|
||||
option_int("string_token_yellow_limit", &tokens),
|
||||
misc_int_to_char(league_cup_get_yellow_red(fix->clid)));
|
||||
}
|
||||
|
||||
/** Free the memory occupied by the tokens array and the permanent tokens. */
|
||||
void
|
||||
lg_commentary_post_match(void)
|
||||
{
|
||||
g_free(token_rep[option_int("string_lg_commentary_token_team_home", &lg_tokens)]);
|
||||
g_free(token_rep[option_int("string_lg_commentary_token_team_away", &lg_tokens)]);
|
||||
g_free(token_rep[option_int("string_lg_commentary_token_attendance", &lg_tokens)]);
|
||||
g_free(token_rep[option_int("string_lg_commentary_token_league_cup_name", &lg_tokens)]);
|
||||
g_free(token_rep[option_int("string_lg_commentary_token_cup_round_name", &lg_tokens)]);
|
||||
g_free(token_rep[option_int("string_lg_commentary_token_yellow_limit", &lg_tokens)]);
|
||||
g_free(token_rep[option_int("string_lg_commentary_token_team_layer0", &lg_tokens)]);
|
||||
g_free(token_rep[option_int("string_lg_commentary_token_team_layer1", &lg_tokens)]);
|
||||
gint i;
|
||||
|
||||
g_free(token_rep);
|
||||
for(i=token_rep[0]->len - 1;i >= 0; i--)
|
||||
{
|
||||
g_free(g_ptr_array_index(token_rep[0], i));
|
||||
g_free(g_ptr_array_index(token_rep[1], i));
|
||||
}
|
||||
|
||||
g_ptr_array_free(token_rep[0], TRUE);
|
||||
g_ptr_array_free(token_rep[1], TRUE);
|
||||
}
|
||||
|
||||
/** Load the appropriate commentary file by evaluating
|
||||
@ -686,7 +587,6 @@ void
|
||||
lg_commentary_load_commentary_file(const gchar *commentary_file, gboolean abort)
|
||||
{
|
||||
gchar *file_name = file_find_support_file(commentary_file, FALSE);
|
||||
gchar buf[SMALL];
|
||||
|
||||
if(file_name != NULL)
|
||||
{
|
||||
@ -696,11 +596,9 @@ lg_commentary_load_commentary_file(const gchar *commentary_file, gboolean abort)
|
||||
else
|
||||
{
|
||||
if(abort)
|
||||
{
|
||||
sprintf(buf, "lg_commentary_load_commentary_file: file %s not found \n",
|
||||
file_name);
|
||||
main_exit_program(EXIT_FILE_NOT_FOUND, buf);
|
||||
}
|
||||
main_exit_program(EXIT_FILE_NOT_FOUND,
|
||||
"lg_commentary_load_commentary_file: file %s not found \n",
|
||||
file_name);
|
||||
else
|
||||
lg_commentary_load_commentary_file("lg_commentary_en.xml", TRUE);
|
||||
}
|
||||
|
@ -41,15 +41,6 @@ lg_commentary_check_commentary(const LGCommentary *commentary, gchar *dest);
|
||||
gboolean
|
||||
query_lg_commentary_is_repetition(gint id);
|
||||
|
||||
gboolean
|
||||
lg_commentary_replace_tokens(gchar *commentary_text);
|
||||
|
||||
void
|
||||
lg_commentary_replace_expressions(gchar *commentary_text);
|
||||
|
||||
gboolean
|
||||
lg_commentary_parse_condition(const gchar *condition);
|
||||
|
||||
void
|
||||
lg_commentary_get_order(const GArray *commentaries, gint *order);
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "misc_callback_func.h"
|
||||
#include "option.h"
|
||||
#include "player.h"
|
||||
#include "strategy.h"
|
||||
#include "support.h"
|
||||
#include "team.h"
|
||||
#include "treeview.h"
|
||||
@ -122,11 +123,12 @@ live_game_initialize(Fixture *fix)
|
||||
gtk_window_set_title(GTK_WINDOW(window.live),
|
||||
league_cup_get_name_string(((LiveGame*)statp)->fix->clid));
|
||||
window_live_set_up();
|
||||
game_gui_live_game_show_opponent_players();
|
||||
}
|
||||
|
||||
game_initialize(fix);
|
||||
|
||||
if(fixture_user_team_involved(match->fix) != -1 || stat5 < -1000)
|
||||
if(fixture_user_team_involved(fix) != -1 || stat5 < -1000)
|
||||
lg_commentary_initialize(fix);
|
||||
}
|
||||
|
||||
@ -503,8 +505,6 @@ live_game_event_injury(gint team, gint player, gboolean create_new)
|
||||
last_unit.event.player)),
|
||||
last_unit.event.player);
|
||||
|
||||
match->subs_left[last_unit.event.team]--;
|
||||
|
||||
if(old_structure != tm[last_unit.event.team]->structure)
|
||||
live_game_event_team_change(last_unit.event.team,
|
||||
LIVE_GAME_EVENT_STRUCTURE_CHANGE);
|
||||
@ -701,9 +701,6 @@ live_game_event_general(gboolean create_new)
|
||||
debug > 130)
|
||||
printf("\t\tlive_game_event_general\n");
|
||||
|
||||
/* if(team_is_user(tm0) == -1 || team_is_user(tm1) == -1) */
|
||||
/* game_check_cpu_strategy(match); */
|
||||
|
||||
if(create_new)
|
||||
{
|
||||
new.minute = live_game_get_minute();
|
||||
@ -761,11 +758,9 @@ live_game_event_general(gboolean create_new)
|
||||
new.area = LIVE_GAME_UNIT_AREA_MIDFIELD;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning("live_game_event_general: unknown event type: %d\n",
|
||||
last_unit.event.type);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"live_game_event_general: unknown event type: %d\n",
|
||||
last_unit.event.type);
|
||||
|
||||
g_array_append_val(unis, new);
|
||||
}
|
||||
@ -773,6 +768,13 @@ live_game_event_general(gboolean create_new)
|
||||
live_game_event_general_get_players();
|
||||
|
||||
live_game_finish_unit();
|
||||
|
||||
/** First, check whether CPU strategy changes are made. */
|
||||
if(team_is_user(tm0) == -1)
|
||||
strategy_live_game_check(match, 0);
|
||||
|
||||
if(team_is_user(tm1) == -1)
|
||||
strategy_live_game_check(match, 1);
|
||||
}
|
||||
|
||||
/** Fill in the players values in a general unit. */
|
||||
@ -914,10 +916,7 @@ live_game_event_send_off(gint team, gint player, gboolean second_yellow)
|
||||
&to_substitute, &substitute);
|
||||
|
||||
if(to_substitute != -1)
|
||||
{
|
||||
live_game_event_substitution(team, substitute, to_substitute);
|
||||
match->subs_left[team]--;
|
||||
}
|
||||
else
|
||||
{
|
||||
tm[team]->structure = team_find_appropriate_structure(tm[team]);
|
||||
@ -957,10 +956,23 @@ live_game_event_substitution(gint team_number, gint sub_in, gint sub_out)
|
||||
|
||||
if(player_of_id_team(tm[team_number], sub_in)->cskill > 0)
|
||||
{
|
||||
match->subs_left[team_number]--;
|
||||
|
||||
player_streak_add_to_prob(
|
||||
player_of_id_team(tm[team_number], sub_in),
|
||||
const_float("float_player_streak_add_sub_out"));
|
||||
|
||||
player_streak_add_to_prob(
|
||||
player_of_id_team(tm[team_number], sub_in),
|
||||
const_float("float_player_streak_add_sub_in"));
|
||||
|
||||
player_games_goals_set(player_of_id_team(tm[team_number], sub_in),
|
||||
match->fix->clid, PLAYER_VALUE_GAMES, 1);
|
||||
player_of_id_team(tm[team_number], sub_in)->career[PLAYER_VALUE_GAMES]++;
|
||||
player_of_id_team(tm[team_number], sub_in)->participation = TRUE;
|
||||
|
||||
if(show)
|
||||
game_gui_live_game_show_opponent_players();
|
||||
}
|
||||
|
||||
g_array_append_val(unis, new);
|
||||
@ -1251,10 +1263,8 @@ live_game_get_minutes_remaining(const LiveGameUnit *unit)
|
||||
|
||||
if(unit->time == LIVE_GAME_UNIT_TIME_EXTRA_TIME)
|
||||
return_value = 120 - current_min;
|
||||
else if(unit->time == LIVE_GAME_UNIT_TIME_SECOND_HALF)
|
||||
else
|
||||
return_value = 90 - current_min;
|
||||
else if(unit->time == LIVE_GAME_UNIT_TIME_FIRST_HALF)
|
||||
return_value = 45 - current_min;
|
||||
|
||||
return return_value;
|
||||
}
|
||||
@ -1393,14 +1403,13 @@ live_game_finish_unit(void)
|
||||
unit->event.player,
|
||||
unit->event.player2);
|
||||
|
||||
if(unit->minute != -1 && unit->time != LIVE_GAME_UNIT_TIME_PENALTIES &&
|
||||
fixture_user_team_involved(match->fix) != -1)
|
||||
if(unit->minute != -1 && unit->time != LIVE_GAME_UNIT_TIME_PENALTIES)
|
||||
{
|
||||
if(debug < 50)
|
||||
game_decrease_fitness(match->fix);
|
||||
game_decrease_fitness(match->fix);
|
||||
game_get_values(match->fix, match->team_values,
|
||||
match->home_advantage);
|
||||
if(stat2 == cur_user && show &&
|
||||
if(fixture_user_team_involved(match->fix) != -1 &&
|
||||
stat2 == cur_user && show &&
|
||||
unit->minute % opt_int("int_opt_live_game_player_list_refresh") == 0)
|
||||
treeview_show_user_player_list();
|
||||
}
|
||||
@ -1513,10 +1522,7 @@ live_game_resume(void)
|
||||
for(j=0;j<3;j++)
|
||||
{
|
||||
if(subs_in[j] != -1)
|
||||
{
|
||||
usr(stat2).live_game.subs_left[i]--;
|
||||
live_game_event_substitution(i, subs_in[j], subs_out[j]);
|
||||
}
|
||||
}
|
||||
|
||||
if(tm[i]->structure != usr(stat2).live_game.team_state[i].structure)
|
||||
@ -1635,11 +1641,9 @@ live_game_event_get_verbosity(gint event_type)
|
||||
else if(event_type == LIVE_GAME_EVENT_GENERAL)
|
||||
return_value = 6;
|
||||
else
|
||||
{
|
||||
g_warning("live_game_event_get_verbosity: unknown event type %d \n",
|
||||
event_type);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"live_game_event_get_verbosity: unknown event type %d \n",
|
||||
event_type);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
25
src/main.c
25
src/main.c
@ -27,6 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
#include "file.h"
|
||||
#include "free.h"
|
||||
@ -40,9 +41,11 @@
|
||||
#include "name_struct.h"
|
||||
#include "option.h"
|
||||
#include "stat_struct.h"
|
||||
#include "strategy_struct.h"
|
||||
#include "transfer_struct.h"
|
||||
#include "variables.h"
|
||||
#include "window.h"
|
||||
#include "xml_strategy.h"
|
||||
|
||||
/** Whether the last save gets loaded at startup
|
||||
(cl switch -l). */
|
||||
@ -131,13 +134,14 @@ main_init_variables(void)
|
||||
transfer_list = g_array_new(FALSE, FALSE, sizeof(Transfer));
|
||||
season_stats = g_array_new(FALSE, FALSE, sizeof(SeasonStat));
|
||||
name_lists = g_array_new(FALSE, FALSE, sizeof(NameList));
|
||||
strategies = g_array_new(FALSE, FALSE, sizeof(Strategy));
|
||||
|
||||
save_file = NULL;
|
||||
|
||||
constants_app.list = settings.list =
|
||||
constants.list = options.list = lg_tokens.list = NULL;
|
||||
constants.list = options.list = tokens.list = NULL;
|
||||
constants_app.datalist = settings.datalist =
|
||||
constants.datalist = options.datalist = lg_tokens.datalist = NULL;
|
||||
constants.datalist = options.datalist = tokens.datalist = NULL;
|
||||
|
||||
popups_active = 0;
|
||||
selected_row = -1;
|
||||
@ -148,6 +152,7 @@ main_init_variables(void)
|
||||
lg_commentary[i] = g_array_new(FALSE, FALSE, sizeof(LGCommentary));
|
||||
|
||||
file_load_conf_files();
|
||||
xml_strategy_load_strategies();
|
||||
|
||||
language_set(language_get_code_index(opt_str("string_opt_language_code")) + 1);
|
||||
|
||||
@ -248,15 +253,23 @@ main (gint argc, gchar *argv[])
|
||||
@param exit_message The message we print.
|
||||
@return The exit code of the program. */
|
||||
void
|
||||
main_exit_program(gint exit_code, gchar *exit_message)
|
||||
main_exit_program(gint exit_code, gchar *format, ...)
|
||||
{
|
||||
gchar text[SMALL];
|
||||
va_list args;
|
||||
|
||||
if(format != NULL)
|
||||
{
|
||||
va_start (args, format);
|
||||
g_vsprintf(text, format, args);
|
||||
va_end (args);
|
||||
g_warning(text);
|
||||
}
|
||||
|
||||
if(gtk_main_level() > 0)
|
||||
gtk_main_quit();
|
||||
|
||||
free_memory();
|
||||
|
||||
if(exit_message != NULL)
|
||||
g_warning(exit_message);
|
||||
|
||||
if(!os_is_unix)
|
||||
{
|
||||
|
@ -33,9 +33,8 @@ void
|
||||
main_init_variables(void);
|
||||
|
||||
void
|
||||
main_exit_program(gint exit_code, gchar *exit_message)
|
||||
__attribute__ ((noreturn));
|
||||
|
||||
main_exit_program(gint exit_code, gchar *format, ...)
|
||||
__attribute__ ((noreturn, format (printf, 2, 3)));
|
||||
|
||||
void
|
||||
main_parse_cl_arguments(gint *argc, gchar ***argv);
|
||||
|
182
src/misc.c
182
src/misc.c
@ -26,6 +26,8 @@
|
||||
#include "main.h"
|
||||
#include "maths.h"
|
||||
#include "misc.h"
|
||||
#include "option.h"
|
||||
#include "variables.h"
|
||||
|
||||
/**
|
||||
Print the contents of a GError (if it was set).
|
||||
@ -37,14 +39,10 @@
|
||||
void
|
||||
misc_print_error(GError **error, gboolean abort_program)
|
||||
{
|
||||
gchar buf[SMALL];
|
||||
|
||||
if(*error == NULL)
|
||||
return;
|
||||
|
||||
sprintf(buf, "%s", (*error)->message);
|
||||
|
||||
g_warning("error message: %s\n", buf);
|
||||
g_warning("error message: %s\n", (*error)->message);
|
||||
g_error_free(*error);
|
||||
*error = NULL;
|
||||
|
||||
@ -487,3 +485,177 @@ misc_string_assign(gchar **string, const gchar *contents)
|
||||
|
||||
*string = g_strdup(contents);
|
||||
}
|
||||
|
||||
/** Choose one of strings separated with '|' */
|
||||
void
|
||||
misc_string_choose_random(gchar *string)
|
||||
{
|
||||
const gchar STR_SEP = '|';
|
||||
gint i = 0;
|
||||
gint count = 1;
|
||||
const gchar* start;
|
||||
|
||||
for (i = 0; string[i]; i++)
|
||||
count += (string[i] == STR_SEP);
|
||||
|
||||
if (count == 1)
|
||||
return;
|
||||
|
||||
count = math_rndi(0, count - 1) + 1;
|
||||
start = string;
|
||||
for (i = 0; string[i]; i++)
|
||||
if (string[i] == STR_SEP)
|
||||
{
|
||||
count--;
|
||||
if (count == 1)
|
||||
start = string + i + 1;
|
||||
else if (!count)
|
||||
{
|
||||
string[i] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
strcpy(string, start);
|
||||
}
|
||||
|
||||
/** Replace simple arithmetic expressions like "1 + 2"
|
||||
and comparisons like "3 < 4" with the appropriate result. */
|
||||
void
|
||||
misc_string_replace_expressions(gchar *string)
|
||||
{
|
||||
gint i, j, last_idx = 0;
|
||||
gint value = -1;
|
||||
gchar buf[SMALL], buf2[SMALL];
|
||||
|
||||
if(debug > 100)
|
||||
printf("misc_string_replace_expressions: #%s#\n",
|
||||
string);
|
||||
|
||||
if(!g_strrstr(string, "["))
|
||||
return;
|
||||
|
||||
strcpy(buf, string);
|
||||
strcpy(string, "");
|
||||
|
||||
for(i=strlen(buf) - 1; i>=0; i--)
|
||||
if(buf[i] == '[')
|
||||
{
|
||||
strncpy(buf2, buf, i);
|
||||
buf2[i] = '\0';
|
||||
strcat(string, buf2);
|
||||
|
||||
for(j=i + 1;j<strlen(buf);j++)
|
||||
{
|
||||
if(buf[j] == ']')
|
||||
{
|
||||
strncpy(buf2, buf + i + 1, j - i - 1);
|
||||
buf2[j - i - 1] = '\0';
|
||||
if (g_strrstr(buf2, "|"))
|
||||
misc_string_choose_random(buf2);
|
||||
else
|
||||
{
|
||||
if(g_strrstr(buf2, "<") ||
|
||||
g_strrstr(buf2, ">") ||
|
||||
g_strrstr(buf2, "=") ||
|
||||
g_strrstr(buf2, " G ") ||
|
||||
g_strrstr(buf2, " L ") ||
|
||||
g_strrstr(buf2, " GE ") ||
|
||||
g_strrstr(buf2, " LE "))
|
||||
misc_parse(buf2, &value);
|
||||
else
|
||||
misc_parse_expression(buf2, &value);
|
||||
sprintf(buf2, "%d", value);
|
||||
}
|
||||
strcat(string, buf2);
|
||||
value = -1;
|
||||
|
||||
last_idx = j + 1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if(last_idx < strlen(buf))
|
||||
{
|
||||
strncpy(buf2, buf + last_idx, strlen(buf) - last_idx);
|
||||
buf2[strlen(buf) - last_idx] = '\0';
|
||||
strcat(string, buf2);
|
||||
}
|
||||
}
|
||||
|
||||
/** Try to replace all special tokens in the string and write the result to dest.
|
||||
@param string The string containing tokens.
|
||||
@param token_rep The arrays with the tokens and replacements.
|
||||
@return TRUE if we could replace all tokens and the commentary condition
|
||||
was fulfilled, FALSE otherwise. */
|
||||
void
|
||||
misc_string_replace_tokens(gchar *string, GPtrArray **token_rep)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<token_rep[0]->len;i++)
|
||||
if(g_strrstr(string,
|
||||
(gchar*)g_ptr_array_index(token_rep[0], i)))
|
||||
misc_string_replace_token(string,
|
||||
(gchar*)g_ptr_array_index(token_rep[0], i),
|
||||
(gchar*)g_ptr_array_index(token_rep[1], i));
|
||||
}
|
||||
|
||||
/** Find out whether the conditions in the string are fulfilled. */
|
||||
gboolean
|
||||
misc_parse_condition(const gchar *condition, GPtrArray **token_rep)
|
||||
{
|
||||
gboolean return_value = FALSE;
|
||||
gchar buf[SMALL], buf2[SMALL];
|
||||
|
||||
strcpy(buf, condition);
|
||||
|
||||
do
|
||||
{
|
||||
strcpy(buf2, buf);
|
||||
misc_string_replace_tokens(buf, token_rep);
|
||||
misc_string_replace_expressions(buf);
|
||||
}
|
||||
while(strcmp(buf2, buf) != 0);
|
||||
|
||||
if(g_strrstr(buf, "_") != NULL)
|
||||
return FALSE;
|
||||
|
||||
misc_parse(buf, &return_value);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Add a replacement rule to the token array.
|
||||
The string should be in allocated as it will
|
||||
get freed later. */
|
||||
void
|
||||
misc_token_add(GPtrArray **token_rep, gint token_idx,
|
||||
gchar *replacement)
|
||||
{
|
||||
g_ptr_array_add(token_rep[0],
|
||||
(gpointer)g_strdup(g_array_index(tokens.list, Option, token_idx).string_value));
|
||||
g_ptr_array_add(token_rep[1], (gpointer)replacement);
|
||||
}
|
||||
|
||||
/** Remove the replacement rule given by the index. */
|
||||
void
|
||||
misc_token_remove(GPtrArray **token_rep, gint idx)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=token_rep[0]->len - 1; i >= 0; i--)
|
||||
if(strcmp((gchar*)g_ptr_array_index(token_rep[0], i),
|
||||
g_array_index(tokens.list, Option, idx).string_value) == 0)
|
||||
{
|
||||
g_free(g_ptr_array_index(token_rep[0], i));
|
||||
g_free(g_ptr_array_index(token_rep[1], i));
|
||||
|
||||
g_ptr_array_remove_index_fast(token_rep[0], i);
|
||||
g_ptr_array_remove_index_fast(token_rep[1], i);
|
||||
}
|
||||
}
|
||||
|
23
src/misc.h
23
src/misc.h
@ -65,7 +65,8 @@ gboolean
|
||||
query_misc_integer_is_in_g_array(gint item, GArray *array);
|
||||
|
||||
void
|
||||
misc_string_replace_token(gchar *string, const gchar *token, const gchar *replacement);
|
||||
misc_string_replace_token(gchar *string, const gchar *token,
|
||||
const gchar *replacement);
|
||||
|
||||
void
|
||||
misc_replace_sums(gchar *string);
|
||||
@ -97,4 +98,24 @@ misc_copy_ptr_array(const GPtrArray *array);
|
||||
void
|
||||
misc_string_assign(gchar **string, const gchar *contents);
|
||||
|
||||
void
|
||||
misc_string_choose_random(gchar *string);
|
||||
|
||||
void
|
||||
misc_string_replace_expressions(gchar *string);
|
||||
|
||||
void
|
||||
misc_string_replace_tokens(gchar *string, GPtrArray **token_rep);
|
||||
|
||||
gboolean
|
||||
misc_parse_condition(const gchar *condition, GPtrArray **token_rep);
|
||||
|
||||
void
|
||||
misc_token_add(GPtrArray **token_rep, gint token_idx,
|
||||
gchar *replacement);
|
||||
|
||||
void
|
||||
misc_token_remove(GPtrArray **token_rep, gint idx);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -183,7 +183,6 @@ misc_callback_pause_live_game(void)
|
||||
|
||||
gtk_widget_set_sensitive(lookup_widget(window.live, "button_pause"), FALSE);
|
||||
gtk_widget_set_sensitive(button_resume, TRUE);
|
||||
/* gui_set_sensitive_lg_meters(FALSE); */
|
||||
gtk_widget_grab_focus(button_resume);
|
||||
|
||||
game_gui_set_main_window_sensitivity(TRUE);
|
||||
|
@ -488,6 +488,9 @@ create_window_live (void)
|
||||
GtkWidget *scrolledwindow11;
|
||||
GtkWidget *treeview_stats;
|
||||
GtkWidget *label81;
|
||||
GtkWidget *scrolledwindow13;
|
||||
GtkWidget *treeview_lg_opponent;
|
||||
GtkWidget *label118;
|
||||
GtkWidget *hbox48;
|
||||
GtkWidget *button_pause;
|
||||
GtkWidget *alignment16;
|
||||
@ -611,6 +614,19 @@ create_window_live (void)
|
||||
gtk_widget_show (label81);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label81);
|
||||
|
||||
scrolledwindow13 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow13);
|
||||
gtk_container_add (GTK_CONTAINER (notebook1), scrolledwindow13);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow13), GTK_SHADOW_IN);
|
||||
|
||||
treeview_lg_opponent = gtk_tree_view_new ();
|
||||
gtk_widget_show (treeview_lg_opponent);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow13), treeview_lg_opponent);
|
||||
|
||||
label118 = gtk_label_new (_("Opponent player list"));
|
||||
gtk_widget_show (label118);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label118);
|
||||
|
||||
hbox48 = gtk_hbox_new (FALSE, 4);
|
||||
gtk_widget_show (hbox48);
|
||||
gtk_box_pack_start (GTK_BOX (vbox36), hbox48, FALSE, TRUE, 5);
|
||||
@ -775,6 +791,9 @@ create_window_live (void)
|
||||
GLADE_HOOKUP_OBJECT (window_live, scrolledwindow11, "scrolledwindow11");
|
||||
GLADE_HOOKUP_OBJECT (window_live, treeview_stats, "treeview_stats");
|
||||
GLADE_HOOKUP_OBJECT (window_live, label81, "label81");
|
||||
GLADE_HOOKUP_OBJECT (window_live, scrolledwindow13, "scrolledwindow13");
|
||||
GLADE_HOOKUP_OBJECT (window_live, treeview_lg_opponent, "treeview_lg_opponent");
|
||||
GLADE_HOOKUP_OBJECT (window_live, label118, "label118");
|
||||
GLADE_HOOKUP_OBJECT (window_live, hbox48, "hbox48");
|
||||
GLADE_HOOKUP_OBJECT (window_live, button_pause, "button_pause");
|
||||
GLADE_HOOKUP_OBJECT (window_live, alignment16, "alignment16");
|
||||
|
@ -123,10 +123,8 @@ name_get_list_from_sid(const gchar *sid)
|
||||
xml_name_read(sid, &new);
|
||||
|
||||
if(new.sid == NULL)
|
||||
{
|
||||
g_warning("name_get_list_from_sid: namelist with sid %s not found", sid);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"name_get_list_from_sid: namelist with sid %s not found", sid);
|
||||
else
|
||||
{
|
||||
name_shorten_list(&new);
|
||||
|
6
src/nonsourcestrings.c
Normal file
6
src/nonsourcestrings.c
Normal file
@ -0,0 +1,6 @@
|
||||
//i18n: file support_files/strategy/strategy_fit.xml line 4
|
||||
// xgettext: no-c-format
|
||||
_("442, defend, fittest players play");
|
||||
//i18n: file support_files/strategy/strategy_normal1.xml line 4
|
||||
// xgettext: no-c-format
|
||||
_("442, balanced, best players play");
|
41
src/option.c
41
src/option.c
@ -36,12 +36,11 @@ option_string(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_string: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
else
|
||||
if(element != NULL)
|
||||
return ((Option*)element)->string_value;
|
||||
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND,
|
||||
"option_string: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -52,12 +51,11 @@ option_string_pointer(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_string: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
else
|
||||
if(element != NULL)
|
||||
return &((Option*)element)->string_value;
|
||||
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND,
|
||||
"option_string: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -72,12 +70,11 @@ option_int(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_int: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
else
|
||||
if(element != NULL)
|
||||
return ((Option*)element)->value;
|
||||
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND,
|
||||
"option_int: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -88,12 +85,11 @@ option_int_pointer(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_int: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
else
|
||||
if(element != NULL)
|
||||
return &((Option*)element)->value;
|
||||
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND,
|
||||
"option_int: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -108,12 +104,11 @@ option_float(const gchar *name, OptionList *optionlist)
|
||||
{
|
||||
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element == NULL)
|
||||
g_warning("option_float: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
else
|
||||
if(element != NULL)
|
||||
return (gfloat)((Option*)element)->value / 100000;
|
||||
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND,
|
||||
"option_float: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -162,10 +157,8 @@ option_add(OptionList *optionlist, const gchar *name,
|
||||
g_datalist_get_data(&optionlist->datalist, name);
|
||||
|
||||
if(element != NULL)
|
||||
{
|
||||
g_warning("Option named '%s' already contained in optionlist.", name);
|
||||
main_exit_program(EXIT_GENERAL, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_OPTION_NOT_FOUND,
|
||||
"Option named '%s' already contained in optionlist.", name);
|
||||
|
||||
new.name = g_strdup(name);
|
||||
new.value = int_value;
|
||||
|
@ -47,16 +47,16 @@ on_button_options_ok_clicked (GtkButton *button,
|
||||
|
||||
if(save_global)
|
||||
{
|
||||
sprintf(buf, "%s/bygfoot.conf", conf_dir);
|
||||
sprintf(buf, "%s%sbygfoot.conf", conf_dir, G_DIR_SEPARATOR_S);
|
||||
file_save_opt_file(buf, &options);
|
||||
}
|
||||
|
||||
if(save_user)
|
||||
{
|
||||
if(strcmp(current_user.name, "NONAME") == 0)
|
||||
sprintf(buf, "%s/bygfoot_user.conf", conf_dir);
|
||||
sprintf(buf, "%s%sbygfoot_user.conf", conf_dir, G_DIR_SEPARATOR_S);
|
||||
else
|
||||
sprintf(buf, "%s/bygfoot_%s.conf", conf_dir, current_user.name);
|
||||
sprintf(buf, "%s%sbygfoot_%s.conf", conf_dir, G_DIR_SEPARATOR_S, current_user.name);
|
||||
|
||||
file_save_opt_file(buf, ¤t_user.options);
|
||||
}
|
||||
|
96
src/player.c
96
src/player.c
@ -55,22 +55,22 @@ player_new(Team *tm, gfloat average_talent, gboolean new_id)
|
||||
new.id = (new_id) ? player_id_new : -1;
|
||||
new.pos = player_get_position_from_structure(tm->structure, tm->players->len);
|
||||
new.cpos = new.pos;
|
||||
new.age = math_gauss_dist(const_float("float_player_age_lower"),
|
||||
const_float("float_player_age_upper"));
|
||||
new.peak_age =
|
||||
math_rnd(const_float("float_player_peak_age_lower") +
|
||||
(new.pos == PLAYER_POS_GOALIE) *
|
||||
const_float("float_player_peak_age_goalie_addition"),
|
||||
const_float("float_player_peak_age_upper") +
|
||||
(new.pos == PLAYER_POS_GOALIE) *
|
||||
const_float("float_player_peak_age_goalie_addition"));
|
||||
new.age = 30;/* math_gauss_dist(const_float("float_player_age_lower"), */
|
||||
/* const_float("float_player_age_upper")); */
|
||||
new.peak_age = 30;
|
||||
/* math_rnd(const_float("float_player_peak_age_lower") + */
|
||||
/* (new.pos == PLAYER_POS_GOALIE) * */
|
||||
/* const_float("float_player_peak_age_goalie_addition"), */
|
||||
/* const_float("float_player_peak_age_upper") + */
|
||||
/* (new.pos == PLAYER_POS_GOALIE) * */
|
||||
/* const_float("float_player_peak_age_goalie_addition")); */
|
||||
|
||||
new.peak_region =
|
||||
math_gauss_dist(const_float("float_player_peak_region_lower"),
|
||||
const_float("float_player_peak_region_upper"));
|
||||
new.peak_region = 2;
|
||||
/* math_gauss_dist(const_float("float_player_peak_region_lower"), */
|
||||
/* const_float("float_player_peak_region_upper")); */
|
||||
|
||||
new.talent = CLAMP(average_talent * skill_factor, 0,
|
||||
const_float("float_player_max_skill"));
|
||||
new.talent = 85;/* CLAMP(average_talent * skill_factor, 0, */
|
||||
/* const_float("float_player_max_skill")); */
|
||||
|
||||
new.skill = player_skill_from_talent(&new);
|
||||
new.cskill = new.skill;
|
||||
@ -312,9 +312,9 @@ player_id_index(const Team *tm, gint player_id)
|
||||
if(g_array_index(tm->players, Player, i).id == player_id)
|
||||
return i;
|
||||
|
||||
g_warning("player_id_index: didn't find player with id %d of team %s\n", player_id, tm->name);
|
||||
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"player_id_index: didn't find player with id %d of team %s\n",
|
||||
player_id, tm->name);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -327,14 +327,9 @@ Player*
|
||||
player_of_idx_team(const Team *tm, gint number)
|
||||
{
|
||||
if(tm->players->len <= number)
|
||||
{
|
||||
g_warning("player_of_idx_team: Player list of team %s too short for number %d.\n",
|
||||
tm->name, number);
|
||||
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"player_of_idx_team: Player list of team %s too short for number %d.\n",
|
||||
tm->name, number);
|
||||
|
||||
return &g_array_index(tm->players, Player, number);
|
||||
}
|
||||
@ -353,9 +348,9 @@ player_of_id_team(const Team *tm, gint id)
|
||||
if(g_array_index(tm->players, Player, i).id == id)
|
||||
return &g_array_index(tm->players, Player, i);
|
||||
|
||||
g_warning("player_of_id_team: didn't find player with id %d of team %s\n", id, tm->name);
|
||||
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"player_of_id_team: didn't find player with id %d of team %s\n",
|
||||
id, tm->name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -587,13 +582,11 @@ player_move(Team *tm1, gint player_number, Team *tm2, gint insert_at)
|
||||
void
|
||||
player_swap(Team *tm1, gint player_number1, Team *tm2, gint player_number2)
|
||||
{
|
||||
gint clid = -1;
|
||||
gint move = (tm1 == tm2 && player_number1 < player_number2) ?
|
||||
-1 : 1;
|
||||
|
||||
if(stat0 == STATUS_LIVE_GAME_PAUSE)
|
||||
{
|
||||
clid = usr(stat2).live_game.fix->clid;
|
||||
if((player_number1 < 11 && player_is_banned(player_of_idx_team(tm1, player_number1)) > 0 &&
|
||||
player_of_idx_team(tm1, player_number1)->participation) ||
|
||||
(player_number2 < 11 && player_is_banned(player_of_idx_team(tm2, player_number2)) > 0 &&
|
||||
@ -699,10 +692,12 @@ player_is_banned(const Player *pl)
|
||||
gfloat
|
||||
player_get_game_skill(const Player *pl, gboolean skill)
|
||||
{
|
||||
if(skill)
|
||||
return pl->skill * powf(pl->fitness, const_float("float_player_fitness_exponent"));
|
||||
|
||||
return pl->cskill * powf(pl->fitness, const_float("float_player_fitness_exponent"));
|
||||
return (skill) ? pl->skill *
|
||||
powf(pl->fitness, const_float("float_player_fitness_exponent")) *
|
||||
(1 + (gfloat)pl->streak * const_float("float_player_streak_influence_skill")) :
|
||||
pl->cskill *
|
||||
powf(pl->fitness, const_float("float_player_fitness_exponent")) *
|
||||
(1 + (gfloat)pl->streak * const_float("float_player_streak_influence_skill"));
|
||||
}
|
||||
|
||||
/** Decrease a player's fitness during a match.
|
||||
@ -861,10 +856,8 @@ player_games_goals_get(const Player *pl, gint clid, gint type)
|
||||
else if(type == PLAYER_VALUE_SHOTS)
|
||||
return_value = g_array_index(pl->games_goals, PlayerGamesGoals, i).shots;
|
||||
else
|
||||
{
|
||||
g_warning("player_games_goals_get: unknown type %d.\n", type);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"player_games_goals_get: unknown type %d.\n", type);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
@ -974,7 +967,8 @@ player_update_injury(Player *pl)
|
||||
{
|
||||
gint i, j;
|
||||
gfloat rndom;
|
||||
gint physio = user_from_team(pl->team)->physio;
|
||||
gint physio = (query_player_is_cpu(pl)) ?
|
||||
QUALITY_GOOD : user_from_team(pl->team)->physio;
|
||||
gfloat injury_decrease_probs[4][3] =
|
||||
{{const_float("float_player_injury_recovery_best0"),
|
||||
const_float("float_player_injury_recovery_best1"),
|
||||
@ -1084,10 +1078,18 @@ player_update_streak(Player *pl)
|
||||
}
|
||||
}
|
||||
|
||||
/** Update a player in a user team (age, skill etc.). */
|
||||
/** Update a player in a team (age, skill etc.). */
|
||||
void
|
||||
player_update_weekly(Player *pl)
|
||||
{
|
||||
if(pl->health > 0)
|
||||
player_update_injury(pl);
|
||||
else
|
||||
player_update_streak(pl);
|
||||
|
||||
if(query_player_is_cpu(pl))
|
||||
return;
|
||||
|
||||
pl->age += 0.0192;
|
||||
|
||||
if(debug < 50)
|
||||
@ -1106,11 +1108,6 @@ player_update_weekly(Player *pl)
|
||||
player_remove_contract(pl);
|
||||
|
||||
player_update_skill(pl);
|
||||
|
||||
if(pl->health > 0)
|
||||
player_update_injury(pl);
|
||||
else
|
||||
player_update_streak(pl);
|
||||
}
|
||||
|
||||
/** Remove a player from a user team after the contract expired.
|
||||
@ -1135,7 +1132,7 @@ player_remove_from_team(Team *tm, gint idx)
|
||||
}
|
||||
|
||||
/** Make some player updates after a match
|
||||
for user players.
|
||||
for players.
|
||||
@param pl The player we update.
|
||||
@param clid The fixture clid. */
|
||||
void
|
||||
@ -1197,10 +1194,9 @@ player_replace_by_new(Player *pl, gboolean free_player)
|
||||
g_array_insert_val(tm->players, idx, new);
|
||||
}
|
||||
|
||||
/** Update players in user teams.
|
||||
/** Update players in teams.
|
||||
@param tm The team of the player.
|
||||
@param idx The index in the players array. */
|
||||
/*d maybe argument player pointer?*/
|
||||
void
|
||||
player_update_week_roundly(Team *tm, gint idx)
|
||||
{
|
||||
@ -1384,10 +1380,6 @@ player_move_from_ya(gint idx)
|
||||
void
|
||||
player_streak_add_to_prob(Player *pl, gfloat add)
|
||||
{
|
||||
/** No streaks for CPU players (yet). */
|
||||
if(team_is_user(pl->team) == -1)
|
||||
return;
|
||||
|
||||
pl->streak_prob += add;
|
||||
pl->streak_prob = CLAMP(pl->streak_prob, -1, 1);
|
||||
}
|
||||
|
@ -38,7 +38,10 @@ enum PlayerCompareAttrib
|
||||
PLAYER_COMPARE_ATTRIBUTE_END
|
||||
};
|
||||
|
||||
/** Whether or not a player is a youth according to his age. */
|
||||
#define query_player_is_youth(pl) (pl->age <= const_float("float_player_age_lower"))
|
||||
/** Whether the player belongs to a cpu team. */
|
||||
#define query_player_is_cpu(pl) (team_is_user(pl->team) == -1)
|
||||
|
||||
/** Reset the streak counter. */
|
||||
#define player_streak_reset_count(pl) pl->streak_count = -math_rnd((gfloat)const_int("int_player_streak_lock_length_lower"), (gfloat)const_int("int_player_streak_lock_length_upper"))
|
||||
|
@ -59,13 +59,13 @@ WeekFunc end_week_round_funcs[] =
|
||||
/** Array of functions called when a week round
|
||||
is started. */
|
||||
WeekFunc start_week_round_funcs[] =
|
||||
{start_week_round_update_user_teams , NULL};
|
||||
{start_week_round_update_teams , NULL};
|
||||
|
||||
/** Array of functions called when a week
|
||||
is started. */
|
||||
WeekFunc start_week_funcs[] =
|
||||
{start_week_add_cups, start_week_update_users,
|
||||
start_week_update_user_teams, start_week_update_user_finances,
|
||||
start_week_update_teams, start_week_update_user_finances,
|
||||
youth_academy_update_weekly, transfer_update, NULL};
|
||||
|
||||
WeekFunc end_week_funcs[] = {stat_update_leagues, end_week_hide_cups, NULL};
|
||||
@ -75,6 +75,7 @@ void
|
||||
start_new_game(void)
|
||||
{
|
||||
start_write_variables();
|
||||
|
||||
start_generate_league_teams();
|
||||
start_new_season();
|
||||
}
|
||||
@ -185,7 +186,7 @@ start_generate_league_teams(void)
|
||||
|
||||
if(ligs->len == 0)
|
||||
main_exit_program(EXIT_NO_LEAGUES,
|
||||
"start_generate_league_teams: no leagues found. there must be at least one league in the game.\n");
|
||||
"start_generate_league_teams: no leagues found. There must be at least one league in the game.\n");
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
for(j=0;j<lig(i).teams->len;j++)
|
||||
@ -461,23 +462,33 @@ start_week_add_cups(void)
|
||||
CPU teams get updated at the end of their matches
|
||||
(to avoid cup teams getting updated too often). */
|
||||
void
|
||||
start_week_update_user_teams(void)
|
||||
start_week_update_teams(void)
|
||||
{
|
||||
gint i;
|
||||
gint i, j;
|
||||
|
||||
for(i=0;i<users->len;i++)
|
||||
team_update_user_team_weekly(usr(i).tm);
|
||||
for(i=0;i<ligs->len;i++)
|
||||
for(j=0;j<lig(i).teams->len;j++)
|
||||
team_update_team_weekly(&g_array_index(lig(i).teams, Team, j));
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
for(j=0;j<cp(i).teams->len;j++)
|
||||
team_update_team_weekly((Team*)g_ptr_array_index(cp(i).teams, j));
|
||||
}
|
||||
|
||||
/** Do some things at the beginning of each new round for
|
||||
the user teams. */
|
||||
void
|
||||
start_week_round_update_user_teams(void)
|
||||
start_week_round_update_teams(void)
|
||||
{
|
||||
gint i;
|
||||
gint i, j;
|
||||
|
||||
for(i=0;i<users->len;i++)
|
||||
team_update_user_team_week_roundly(usr(i).tm);
|
||||
for(i=0;i<ligs->len;i++)
|
||||
for(j=0;j<lig(i).teams->len;j++)
|
||||
team_update_team_week_roundly(&g_array_index(lig(i).teams, Team, j));
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
for(j=0;j<cp(i).teams->len;j++)
|
||||
team_update_team_week_roundly((Team*)g_ptr_array_index(cp(i).teams, j));
|
||||
}
|
||||
|
||||
/** Deduce wages etc. */
|
||||
|
@ -57,10 +57,10 @@ void
|
||||
start_week(void);
|
||||
|
||||
void
|
||||
start_week_update_user_teams(void);
|
||||
start_week_update_teams(void);
|
||||
|
||||
void
|
||||
start_week_round_update_user_teams(void);
|
||||
start_week_round_update_teams(void);
|
||||
|
||||
void
|
||||
start_week_update_user_finances(void);
|
||||
|
574
src/strategy.c
Normal file
574
src/strategy.c
Normal file
@ -0,0 +1,574 @@
|
||||
/*
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "fixture.h"
|
||||
#include "league.h"
|
||||
#include "live_game.h"
|
||||
#include "main.h"
|
||||
#include "misc.h"
|
||||
#include "option.h"
|
||||
#include "player.h"
|
||||
#include "strategy.h"
|
||||
#include "team.h"
|
||||
|
||||
GPtrArray *token_strat[2];
|
||||
|
||||
/** Return the sid of a random strategy from the
|
||||
strategies array (also dependent on the priorities
|
||||
of the strategies). */
|
||||
gchar*
|
||||
strategy_get_random(void)
|
||||
{
|
||||
gint i, rndom =
|
||||
math_rndi(1, g_array_index(strategies, Strategy, strategies->len - 1).priority);
|
||||
|
||||
if(rndom <= g_array_index(strategies, Strategy, 0).priority)
|
||||
return g_strdup(g_array_index(strategies, Strategy, 0).sid);
|
||||
|
||||
for(i=1;i<strategies->len;i++)
|
||||
if(rndom <= g_array_index(strategies, Strategy, i).priority)
|
||||
return g_strdup(g_array_index(strategies, Strategy, i).sid);
|
||||
|
||||
main_exit_program(EXIT_STRATEGY_ERROR, "team_strategy_get_random: no strategy found.");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Compare function for sorting the players given a specific
|
||||
strategy. */
|
||||
gint
|
||||
strategy_compare_players(gconstpointer a,
|
||||
gconstpointer b,
|
||||
gpointer user_data)
|
||||
{
|
||||
const Player *pl1 = *(const Player**)a;
|
||||
const Player *pl2 = *(const Player**)b;
|
||||
const StrategyPrematch *strat = (StrategyPrematch*)user_data;
|
||||
gint return_value = 0;
|
||||
|
||||
if(pl1->pos != pl2->pos)
|
||||
return_value = misc_int_compare(pl2->pos, pl1->pos);
|
||||
else if(pl1->cskill == 0 && pl2->cskill > 0)
|
||||
return_value = 1;
|
||||
else if(pl2->cskill == 0 && pl1->cskill > 0)
|
||||
return_value = -1;
|
||||
else if(strat->min_fitness != 0 &&
|
||||
pl1->fitness < strat->min_fitness &&
|
||||
pl2->fitness >= strat->min_fitness)
|
||||
return_value = 1;
|
||||
else if(strat->min_fitness != 0 &&
|
||||
pl1->fitness >= strat->min_fitness &&
|
||||
pl2->fitness < strat->min_fitness)
|
||||
return_value = -1;
|
||||
else
|
||||
{
|
||||
gfloat skill1 = player_get_game_skill(pl1, TRUE),
|
||||
skill2 = player_get_game_skill(pl2, TRUE);
|
||||
|
||||
if(strat->lineup == STRAT_LINEUP_BEST)
|
||||
return_value = misc_float_compare(skill1, skill2);
|
||||
else if(strat->lineup == STRAT_LINEUP_WEAKEST)
|
||||
return_value = misc_float_compare(skill2, skill1);
|
||||
else if(strat->lineup == STRAT_LINEUP_FITTEST)
|
||||
{
|
||||
return_value = misc_float_compare(pl1->fitness, pl2->fitness);
|
||||
if(pl1->fitness == pl2->fitness)
|
||||
return_value = misc_float_compare(skill1, skill2);
|
||||
}
|
||||
else
|
||||
g_warning("strategy_compare_players: unknown lineup type %d\n", strat->lineup);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Check whether a lineup described in the prematch using the given
|
||||
formation can be made with the players. */
|
||||
gboolean
|
||||
query_strategy_formation_possible(const GPtrArray *players, const StrategyPrematch *prematch,
|
||||
gint formation)
|
||||
{
|
||||
gint i, pos[3] = {0, 0, 0};
|
||||
|
||||
for(i=0;i<players->len;i++)
|
||||
if(((Player*)g_ptr_array_index(players, i))->pos > 0 &&
|
||||
((Player*)g_ptr_array_index(players, i))->cskill > 0 &&
|
||||
((Player*)g_ptr_array_index(players, i))->fitness >=
|
||||
prematch->min_fitness)
|
||||
pos[((Player*)g_ptr_array_index(players, i))->pos - 1]++;
|
||||
|
||||
if(pos[2] >= math_get_place(formation, 1) &&
|
||||
pos[1] >= math_get_place(formation, 2) &&
|
||||
pos[0] >= math_get_place(formation, 3))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/** Make the necessary substitutions to satisfy the given prematch
|
||||
and formation requirements. */
|
||||
void
|
||||
strategy_update_lineup(Team *tm, const GPtrArray *players,
|
||||
const StrategyPrematch *prematch, gint formation)
|
||||
{
|
||||
gint i;
|
||||
GArray *ids = g_array_new(FALSE, FALSE, sizeof(gint));
|
||||
GArray *new_players = g_array_new(FALSE, FALSE, sizeof(Player));
|
||||
gint form[3] = {math_get_place(formation, 3),
|
||||
math_get_place(formation, 2),
|
||||
math_get_place(formation, 1)},
|
||||
pos[3] = {0, 0, 0};
|
||||
|
||||
/* Repair goalie if necessary. */
|
||||
if(((Player*)g_ptr_array_index(players, 0))->cskill == 0)
|
||||
strategy_repair_player((Player*)g_ptr_array_index(players, 0));
|
||||
|
||||
g_array_append_val(ids, ((Player*)g_ptr_array_index(players, 0))->id);
|
||||
|
||||
for(i=0;i<players->len;i++)
|
||||
if(((Player*)g_ptr_array_index(players, i))->pos > 0 &&
|
||||
pos[((Player*)g_ptr_array_index(players, i))->pos - 1] <
|
||||
form[((Player*)g_ptr_array_index(players, i))->pos - 1])
|
||||
{
|
||||
g_array_append_val(ids, ((Player*)g_ptr_array_index(players, i))->id);
|
||||
pos[((Player*)g_ptr_array_index(players, i))->pos - 1]++;
|
||||
}
|
||||
|
||||
for(i=0;i<ids->len;i++)
|
||||
g_array_append_val(new_players,
|
||||
*(player_of_id_team(tm, g_array_index(ids, gint, i))));
|
||||
|
||||
for(i=0;i<tm->players->len;i++)
|
||||
if(!query_misc_integer_is_in_g_array(
|
||||
g_array_index(tm->players, Player, i).id, ids))
|
||||
g_array_append_val(new_players, g_array_index(tm->players, Player, i));
|
||||
|
||||
g_array_free(tm->players, TRUE);
|
||||
tm->players = new_players;
|
||||
g_array_free(ids, TRUE);
|
||||
|
||||
tm->structure = formation;
|
||||
team_rearrange(tm);
|
||||
}
|
||||
|
||||
/** Delete red cards, cure injuries etc. Used to
|
||||
make sure a CPU team doesn't break. */
|
||||
void
|
||||
strategy_repair_player(Player *pl)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<pl->cards->len;i++)
|
||||
g_array_index(pl->cards, PlayerCard, i).red = 0;
|
||||
|
||||
pl->health =
|
||||
pl->recovery = 0;
|
||||
pl->cskill =
|
||||
player_get_cskill(pl, pl->pos, FALSE);
|
||||
|
||||
pl->fitness =
|
||||
math_rnd(const_float("float_player_fitness_lower"),
|
||||
const_float("float_player_fitness_upper"));
|
||||
}
|
||||
|
||||
/** 'Repair' exactly as many players as are required to be able
|
||||
to make a lineup of healthy players with the primary formation
|
||||
of the given prematch. */
|
||||
void
|
||||
strategy_repair_players(GPtrArray *players,
|
||||
const StrategyPrematch *prematch)
|
||||
{
|
||||
gint i, j;
|
||||
gint form[3] =
|
||||
{math_get_place(g_array_index(prematch->formations, gint, 0), 3),
|
||||
math_get_place(g_array_index(prematch->formations, gint, 0), 2),
|
||||
math_get_place(g_array_index(prematch->formations, gint, 0), 1)};
|
||||
gint pos[3] = {0, 0, 0};
|
||||
|
||||
for(i=0;i<players->len;i++)
|
||||
if(((Player*)g_ptr_array_index(players, i))->pos > 0 &&
|
||||
((Player*)g_ptr_array_index(players, i))->cskill > 0)
|
||||
pos[((Player*)g_ptr_array_index(players, i))->pos - 1]++;
|
||||
|
||||
for(i=0;i<3;i++)
|
||||
{
|
||||
while(pos[i] < form[i])
|
||||
for(j=0;j<players->len;j++)
|
||||
if(((Player*)g_ptr_array_index(players, j))->pos == i + 1 &&
|
||||
((Player*)g_ptr_array_index(players, j))->cskill == 0)
|
||||
{
|
||||
strategy_repair_player((Player*)g_ptr_array_index(players, j));
|
||||
pos[i]++;
|
||||
}
|
||||
}
|
||||
|
||||
g_ptr_array_sort_with_data(players, (GCompareDataFunc)strategy_compare_players,
|
||||
(gpointer)prematch);
|
||||
}
|
||||
|
||||
/** Make team changes according to the rules in the prematch. */
|
||||
void
|
||||
strategy_apply_prematch(Team *tm, const StrategyPrematch *prematch)
|
||||
{
|
||||
gint i;
|
||||
GPtrArray *players = player_get_pointers_from_array(tm->players);
|
||||
|
||||
tm->style = prematch->style;
|
||||
tm->boost = prematch->boost;
|
||||
|
||||
g_ptr_array_sort_with_data(players, (GCompareDataFunc)strategy_compare_players,
|
||||
(gpointer)prematch);
|
||||
|
||||
for(i=0;i<prematch->formations->len;i++)
|
||||
if(query_strategy_formation_possible(
|
||||
players, prematch,
|
||||
g_array_index(prematch->formations, gint, i)))
|
||||
{
|
||||
strategy_update_lineup(
|
||||
tm, players,prematch,
|
||||
g_array_index(prematch->formations, gint, i));
|
||||
break;
|
||||
}
|
||||
|
||||
/* We have to repair players to be able to satisfy
|
||||
a formation. */
|
||||
if(i == prematch->formations->len)
|
||||
{
|
||||
strategy_repair_players(players, prematch);
|
||||
strategy_update_lineup(tm, players, prematch,
|
||||
g_array_index(prematch->formations, gint, 0));
|
||||
}
|
||||
|
||||
g_ptr_array_free(players, TRUE);
|
||||
}
|
||||
|
||||
/** Make necessary subs etc. for a CPU team. */
|
||||
void
|
||||
strategy_update_team_pre_match(Team *tm)
|
||||
{
|
||||
gint i;
|
||||
const GArray *prematches =
|
||||
strategy_from_sid(tm->strategy_sid)->prematch;
|
||||
|
||||
strategy_set_tokens(tm, NULL);
|
||||
|
||||
for(i=prematches->len - 1; i >= 0; i--)
|
||||
if(g_array_index(prematches, StrategyPrematch, i).condition == NULL ||
|
||||
misc_parse_condition(g_array_index(prematches, StrategyPrematch, i).condition,
|
||||
token_strat))
|
||||
{
|
||||
strategy_apply_prematch(tm, &g_array_index(prematches, StrategyPrematch, i));
|
||||
break;
|
||||
}
|
||||
|
||||
strategy_free_tokens();
|
||||
|
||||
if(i == -1)
|
||||
main_exit_program(EXIT_STRATEGY_ERROR,
|
||||
"strategy_update_team_pre_match: none of the prematch conditions of strategy %s for team %s are fulfilled. remember that a strategy should contain an unconditional prematch.",
|
||||
tm->strategy_sid, tm->name);
|
||||
}
|
||||
|
||||
/** Get the strategy going with the sid. */
|
||||
Strategy*
|
||||
strategy_from_sid(const gchar *sid)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<strategies->len;i++)
|
||||
if(strcmp(g_array_index(strategies, Strategy, i).sid, sid) == 0)
|
||||
return &g_array_index(strategies, Strategy, i);
|
||||
|
||||
main_exit_program(EXIT_STRATEGY_ERROR,
|
||||
"strategy_from_sid: strategy '%s' not found.", sid);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Add tokens that will be evaluated when checking
|
||||
strategy conditions. */
|
||||
void
|
||||
strategy_set_tokens(const Team *tm, const Fixture *fixture)
|
||||
{
|
||||
const Fixture *fix = (fixture == NULL) ?
|
||||
team_get_fixture(tm, FALSE) : fixture;
|
||||
const Team *opp = (fix == NULL) ? NULL :
|
||||
fix->teams[fix->teams[0] == tm];
|
||||
|
||||
token_strat[0] = g_ptr_array_new();
|
||||
token_strat[1] = g_ptr_array_new();
|
||||
|
||||
if(opp == NULL)
|
||||
return;
|
||||
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_homeadv", &tokens),
|
||||
misc_int_to_char(((fix->teams[0] == tm) ? 1 : -1) *
|
||||
fix->home_advantage));
|
||||
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_cup", &tokens),
|
||||
misc_int_to_char(fix->clid >= ID_CUP_START));
|
||||
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_avskilldiff", &tokens),
|
||||
misc_int_to_char((gint)rint(team_get_average_skill(tm, FALSE) -
|
||||
team_get_average_skill(opp, FALSE))));
|
||||
if(tm->clid < ID_CUP_START &&
|
||||
opp->clid < ID_CUP_START)
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_team_layerdiff", &tokens),
|
||||
misc_int_to_char(league_from_clid(tm->clid)->layer -
|
||||
league_from_clid(opp->clid)->layer));
|
||||
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_goals_to_win", &tokens),
|
||||
misc_int_to_char(fixture_get_goals_to_win(fix, tm)));
|
||||
}
|
||||
|
||||
/** Free the token arrays. */
|
||||
void
|
||||
strategy_free_tokens(void)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<token_strat[0]->len;i++)
|
||||
{
|
||||
g_free(g_ptr_array_index(token_strat[0], i));
|
||||
g_free(g_ptr_array_index(token_strat[1], i));
|
||||
}
|
||||
|
||||
g_ptr_array_free(token_strat[0], TRUE);
|
||||
g_ptr_array_free(token_strat[1], TRUE);
|
||||
}
|
||||
|
||||
/** Fill the necessary tokens during a live game. */
|
||||
void
|
||||
strategy_live_game_set_tokens(const LiveGame *match, gint team_idx)
|
||||
{
|
||||
gint tmp_int,
|
||||
current_min = live_game_unit_get_minute(
|
||||
&g_array_index(match->units, LiveGameUnit, match->units->len - 1));
|
||||
const Team *tm = match->fix->teams[team_idx];
|
||||
|
||||
strategy_set_tokens(tm, match->fix);
|
||||
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_subs_left", &tokens),
|
||||
misc_int_to_char(match->subs_left[team_idx]));
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_num_def", &tokens),
|
||||
misc_int_to_char(math_get_place(tm->structure, 3)));
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_num_mid", &tokens),
|
||||
misc_int_to_char(math_get_place(tm->structure, 2)));
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_num_att", &tokens),
|
||||
misc_int_to_char(math_get_place(tm->structure, 1)));
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_form", &tokens),
|
||||
misc_int_to_char(tm->structure));
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_time", &tokens),
|
||||
misc_int_to_char(
|
||||
g_array_index(match->units, LiveGameUnit, match->units->len - 1).time));
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_minute", &tokens),
|
||||
misc_int_to_char(current_min));
|
||||
|
||||
tmp_int = live_game_get_minutes_remaining(
|
||||
&g_array_index(match->units, LiveGameUnit, match->units->len - 1));
|
||||
|
||||
if(tmp_int > 0)
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_minute_remaining", &tokens),
|
||||
misc_int_to_char(tmp_int));
|
||||
|
||||
if(query_fixture_is_draw(match->fix))
|
||||
tmp_int = 120 - current_min;
|
||||
else
|
||||
tmp_int = 90 - current_min;
|
||||
|
||||
if(tmp_int > 0)
|
||||
misc_token_add(token_strat,
|
||||
option_int("string_token_minute_total", &tokens),
|
||||
misc_int_to_char(tmp_int));
|
||||
}
|
||||
|
||||
/** Compare function for sorting the players when
|
||||
looking for substitutes. */
|
||||
gint
|
||||
strategy_compare_players_sub(gconstpointer a,
|
||||
gconstpointer b,
|
||||
gpointer user_data)
|
||||
{
|
||||
gfloat skill1, skill2;
|
||||
const Player *pl1 = *(const Player**)a;
|
||||
const Player *pl2 = *(const Player**)b;
|
||||
gint type = GPOINTER_TO_INT(user_data);
|
||||
gint return_value = 0;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
default:
|
||||
g_warning("strategy_compare_players_sub: unknown type %d\n",
|
||||
type);
|
||||
return_value = 0;
|
||||
break;
|
||||
case STRAT_LINEUP_FITTEST:
|
||||
return_value = misc_float_compare(pl1->fitness,
|
||||
pl2->fitness);
|
||||
break;
|
||||
case STRAT_LINEUP_UNFITTEST:
|
||||
return_value = misc_float_compare(pl2->fitness,
|
||||
pl1->fitness);
|
||||
break;
|
||||
case STRAT_LINEUP_BEST:
|
||||
skill1 = player_get_game_skill(pl1, TRUE);
|
||||
skill2 = player_get_game_skill(pl2, TRUE);
|
||||
return_value = misc_float_compare(skill1, skill2);
|
||||
break;
|
||||
case STRAT_LINEUP_WEAKEST:
|
||||
skill1 = player_get_game_skill(pl1, TRUE);
|
||||
skill2 = player_get_game_skill(pl2, TRUE);
|
||||
return_value = misc_float_compare(skill2, skill1);
|
||||
break;
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Find an appropriate player to send out or in.
|
||||
@param tm The team we work with.
|
||||
@param position The position of the player we seek.
|
||||
@param property According to which property to sort players.
|
||||
@param sub_in Whether we look for a player to send in or out. */
|
||||
gint
|
||||
strategy_get_sub(const Team *tm, gint position,
|
||||
gint property, gboolean sub_in)
|
||||
{
|
||||
gint i, start = (sub_in) ? 11 : 0,
|
||||
stop = (sub_in) ? tm->players->len : 11;
|
||||
GPtrArray *players = g_ptr_array_new();
|
||||
gint return_value = -1;
|
||||
|
||||
for(i=start;i<stop;i++)
|
||||
if(player_of_idx_team(tm, i)->pos == position &&
|
||||
player_of_idx_team(tm, i)->cskill > 0 &&
|
||||
(i > 10 || player_is_banned(player_of_idx_team(tm, i)) <= 0))
|
||||
g_ptr_array_add(players, (gpointer)player_of_idx_team(tm, i));
|
||||
|
||||
if(players->len == 0)
|
||||
{
|
||||
g_ptr_array_free(players, TRUE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_ptr_array_sort_with_data(players,
|
||||
(GCompareDataFunc)strategy_compare_players_sub,
|
||||
GINT_TO_POINTER(property));
|
||||
|
||||
return_value = ((Player*)g_ptr_array_index(players, 0))->id;
|
||||
|
||||
g_ptr_array_free(players, TRUE);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
/** Apply the strategy actions specified to the given team. */
|
||||
void
|
||||
strategy_live_game_apply_action(LiveGame *match, gint team_idx,
|
||||
const StrategyMatchAction *action)
|
||||
{
|
||||
gint sub_in_id = -1, sub_out_id = -1;
|
||||
Team *tm = match->fix->teams[team_idx];
|
||||
gint old_form = tm->structure;
|
||||
|
||||
if(action->style != -100 && tm->style != action->style)
|
||||
{
|
||||
tm->style = action->style;
|
||||
live_game_event_team_change(team_idx,
|
||||
LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_DEFEND +
|
||||
tm->style + 2);
|
||||
}
|
||||
|
||||
if(action->boost != -100 && tm->boost != action->boost)
|
||||
{
|
||||
tm->boost = action->boost;
|
||||
live_game_event_team_change(team_idx,
|
||||
LIVE_GAME_EVENT_BOOST_CHANGE_ANTI +
|
||||
tm->boost + 1);
|
||||
}
|
||||
|
||||
if(action->sub_in_pos != -1 && match->subs_left[team_idx] > 0)
|
||||
{
|
||||
sub_in_id = strategy_get_sub(tm, action->sub_in_pos,
|
||||
action->sub_in_prop, TRUE);
|
||||
sub_out_id = strategy_get_sub(tm, action->sub_out_pos,
|
||||
action->sub_in_prop, FALSE);
|
||||
|
||||
if(sub_in_id > 0 && sub_out_id > 0)
|
||||
{
|
||||
player_swap(tm, player_id_index(tm, sub_out_id),
|
||||
tm, player_id_index(tm, sub_in_id));
|
||||
|
||||
team_change_structure(tm, team_find_appropriate_structure(tm));
|
||||
team_rearrange(tm);
|
||||
|
||||
live_game_event_substitution(team_idx, sub_in_id, sub_out_id);
|
||||
|
||||
if(tm->structure != old_form)
|
||||
live_game_event_team_change(team_idx,
|
||||
LIVE_GAME_EVENT_STRUCTURE_CHANGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Take match actions specified in the team's strategy
|
||||
if necessary. */
|
||||
void
|
||||
strategy_live_game_check(LiveGame *match, gint team_idx)
|
||||
{
|
||||
gint i;
|
||||
Team *tm = match->fix->teams[team_idx];
|
||||
const Strategy *strat = strategy_from_sid(tm->strategy_sid);
|
||||
|
||||
strategy_live_game_set_tokens(match, team_idx);
|
||||
|
||||
for(i=strat->match_action->len - 1; i >= 0; i--)
|
||||
{
|
||||
if((match->subs_left[team_idx] > 0 ||
|
||||
g_array_index(strat->match_action, StrategyMatchAction, i).sub_in_pos == -1) &&
|
||||
misc_parse_condition(
|
||||
g_array_index(strat->match_action, StrategyMatchAction, i).condition,
|
||||
token_strat))
|
||||
{
|
||||
strategy_live_game_apply_action(
|
||||
match, team_idx,
|
||||
&g_array_index(strat->match_action, StrategyMatchAction, i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
strategy_free_tokens();
|
||||
}
|
92
src/strategy.h
Normal file
92
src/strategy.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef STRATEGY_H
|
||||
#define STRATEGY_H
|
||||
|
||||
#include "bygfoot.h"
|
||||
#include "strategy_struct.h"
|
||||
/* #include "team_struct.h" */
|
||||
#include "variables.h"
|
||||
|
||||
void
|
||||
strategy_update_team_pre_match(Team *tm);
|
||||
|
||||
gint
|
||||
strategy_compare_players(gconstpointer a,
|
||||
gconstpointer b,
|
||||
gpointer user_data);
|
||||
gchar*
|
||||
strategy_get_random(void);
|
||||
|
||||
Strategy*
|
||||
strategy_from_sid(const gchar *sid);
|
||||
|
||||
gboolean
|
||||
query_strategy_formation_possible(const GPtrArray *players,
|
||||
const StrategyPrematch *prematch,
|
||||
gint formation);
|
||||
|
||||
void
|
||||
strategy_update_lineup(Team *tm, const GPtrArray *players,
|
||||
const StrategyPrematch *prematch, gint formation);
|
||||
|
||||
void
|
||||
strategy_repair_player(Player *pl);
|
||||
|
||||
void
|
||||
strategy_repair_players(GPtrArray *players,
|
||||
const StrategyPrematch *prematch);
|
||||
|
||||
void
|
||||
strategy_set_tokens(const Team *tm, const Fixture *fix);
|
||||
|
||||
void
|
||||
strategy_free_tokens(void);
|
||||
|
||||
void
|
||||
strategy_apply_prematch(Team *tm, const StrategyPrematch *prematch);
|
||||
|
||||
void
|
||||
strategy_live_game_set_tokens(const LiveGame *match, gint team_idx);
|
||||
|
||||
void
|
||||
strategy_live_game_check(LiveGame *match, gint team_idx);
|
||||
|
||||
void
|
||||
strategy_live_game_apply_action(LiveGame *match, gint team_idx,
|
||||
const StrategyMatchAction *action);
|
||||
|
||||
void
|
||||
strategy_live_game_initialize(const Fixture *fix);
|
||||
|
||||
gint
|
||||
strategy_compare_players_sub(gconstpointer a,
|
||||
gconstpointer b,
|
||||
gpointer user_data);
|
||||
|
||||
gint
|
||||
strategy_get_sub(const Team *tm, gint position,
|
||||
gint property, gboolean sub_in);
|
||||
|
||||
#endif
|
80
src/strategy_struct.h
Normal file
80
src/strategy_struct.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef STRATEGY_STRUCT_H
|
||||
#define STRATEGY_STRUCT_H
|
||||
|
||||
/** Lineup types for a CPU team (ie. which players
|
||||
are preferred when putting together the first 11). */
|
||||
enum StratLineupType
|
||||
{
|
||||
STRAT_LINEUP_BEST = 0,
|
||||
STRAT_LINEUP_WEAKEST,
|
||||
STRAT_LINEUP_FITTEST,
|
||||
STRAT_LINEUP_UNFITTEST,
|
||||
STRAT_LINEUP_END
|
||||
};
|
||||
|
||||
/** A struct describing the pre-match strategy settings
|
||||
of a CPU team. */
|
||||
typedef struct
|
||||
{
|
||||
/** A condition describing when the strategy should be applied. */
|
||||
gchar *condition;
|
||||
/** Array of possible formations, sorted by preference. */
|
||||
GArray *formations;
|
||||
/** Boost, style values and lineup type. */
|
||||
gint boost, style, lineup;
|
||||
/** The fitness value below which a player gets substituted
|
||||
if there's a sub with better fitness. */
|
||||
gfloat min_fitness;
|
||||
} StrategyPrematch;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/** A condition describing when the action should be taken. */
|
||||
gchar *condition;
|
||||
/** New boost and style values. */
|
||||
gint boost, style;
|
||||
/** Substitution specifiers (position and property).
|
||||
Property is taken from #StratLineupType. */
|
||||
gint sub_in_pos, sub_in_prop,
|
||||
sub_out_pos, sub_out_prop;
|
||||
|
||||
} StrategyMatchAction;
|
||||
|
||||
/** A CPU strategy. */
|
||||
typedef struct
|
||||
{
|
||||
/** String id and description of the strategy. */
|
||||
gchar *sid, *desc;
|
||||
/** How often this strategy gets picked, relative
|
||||
to the other strategies. */
|
||||
gint priority;
|
||||
/** Array with prematch settings. */
|
||||
GArray *prematch;
|
||||
/** Array with match settings. */
|
||||
GArray *match_action;
|
||||
} Strategy;
|
||||
|
||||
#endif
|
198
src/team.c
198
src/team.c
@ -32,6 +32,7 @@
|
||||
#include "misc.h"
|
||||
#include "option.h"
|
||||
#include "player.h"
|
||||
#include "strategy.h"
|
||||
#include "team.h"
|
||||
#include "transfer.h"
|
||||
#include "user.h"
|
||||
@ -48,16 +49,14 @@ team_new(gboolean new_id)
|
||||
{
|
||||
Team new;
|
||||
|
||||
new.name = NULL;
|
||||
new.names_file = NULL;
|
||||
new.symbol = NULL;
|
||||
new.def_file = NULL;
|
||||
new.stadium.name = NULL;
|
||||
new.name = new.names_file =
|
||||
new.symbol = new.def_file =
|
||||
new.stadium.name = new.strategy_sid = NULL;
|
||||
|
||||
new.clid = -1;
|
||||
new.id = (new_id) ? team_id_new : -1;
|
||||
new.structure = team_assign_playing_structure();
|
||||
new.style = team_assign_playing_style();
|
||||
new.structure = 442; ///*dteam_assign_playing_structure();
|
||||
new.style = 0; ///*dteam_assign_playing_style();
|
||||
new.boost = 0;
|
||||
new.average_talent = 0;
|
||||
|
||||
@ -126,6 +125,8 @@ team_generate_players_stadium(Team *tm)
|
||||
gfloat wages = 0, average_talent;
|
||||
gchar *def_file = team_has_def_file(tm);
|
||||
|
||||
tm->strategy_sid = strategy_get_random();
|
||||
|
||||
tm->stadium.average_attendance = tm->stadium.possible_attendance =
|
||||
tm->stadium.games = 0;
|
||||
tm->stadium.safety =
|
||||
@ -246,9 +247,8 @@ team_of_id(gint id)
|
||||
if(((Team*)g_ptr_array_index(cp(i).teams, j))->id == id)
|
||||
return (Team*)g_ptr_array_index(cp(i).teams, j);
|
||||
|
||||
g_warning("team_of_id: team with id %d not found.", id);
|
||||
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"team_of_id: team with id %d not found.", id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -271,21 +271,22 @@ team_get_fixture(const Team *tm, gboolean last_fixture)
|
||||
|
||||
if(!last_fixture)
|
||||
{
|
||||
for(i=0;i<ligs->len;i++)
|
||||
{
|
||||
if(lig(i).active && lig(i).id == tm->clid)
|
||||
if(tm->clid < ID_CUP_START)
|
||||
for(i=0;i<ligs->len;i++)
|
||||
{
|
||||
for(j=0;j<lig(i).fixtures->len;j++)
|
||||
if(g_array_index(lig(i).fixtures, Fixture, j).attendance == -1 &&
|
||||
query_fixture_team_involved((&g_array_index(lig(i).fixtures, Fixture, j)), tm->id))
|
||||
{
|
||||
fix = &g_array_index(lig(i).fixtures, Fixture, j);
|
||||
break;
|
||||
}
|
||||
if(lig(i).active && lig(i).id == tm->clid)
|
||||
{
|
||||
for(j=0;j<lig(i).fixtures->len;j++)
|
||||
if(g_array_index(lig(i).fixtures, Fixture, j).attendance == -1 &&
|
||||
query_fixture_team_involved((&g_array_index(lig(i).fixtures, Fixture, j)), tm->id))
|
||||
{
|
||||
fix = &g_array_index(lig(i).fixtures, Fixture, j);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
if(fix == NULL ||
|
||||
@ -309,21 +310,22 @@ team_get_fixture(const Team *tm, gboolean last_fixture)
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0;i<ligs->len;i++)
|
||||
{
|
||||
if(lig(i).active && lig(i).id == tm->clid)
|
||||
if(tm->clid < ID_CUP_START)
|
||||
for(i=0;i<ligs->len;i++)
|
||||
{
|
||||
for(j=lig(i).fixtures->len - 1;j>=0;j--)
|
||||
if(g_array_index(lig(i).fixtures, Fixture, j).attendance != -1 &&
|
||||
query_fixture_team_involved((&g_array_index(lig(i).fixtures, Fixture, j)), tm->id))
|
||||
{
|
||||
fix = &g_array_index(lig(i).fixtures, Fixture, j);
|
||||
break;
|
||||
}
|
||||
if(lig(i).active && lig(i).id == tm->clid)
|
||||
{
|
||||
for(j=lig(i).fixtures->len - 1;j>=0;j--)
|
||||
if(g_array_index(lig(i).fixtures, Fixture, j).attendance != -1 &&
|
||||
query_fixture_team_involved((&g_array_index(lig(i).fixtures, Fixture, j)), tm->id))
|
||||
{
|
||||
fix = &g_array_index(lig(i).fixtures, Fixture, j);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
if(fix == NULL ||
|
||||
@ -434,10 +436,9 @@ team_get_league_rank(const Team *tm)
|
||||
if(g_array_index(elements, TableElement, i).team_id == tm->id)
|
||||
return i + 1;
|
||||
|
||||
g_warning("team_get_league_rank: no rank found for team %s in league %s. \n",
|
||||
tm->name, league_cup_get_name_string(tm->clid));
|
||||
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"team_get_league_rank: no rank found for team %s in league %s. \n",
|
||||
tm->name, league_cup_get_name_string(tm->clid));
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -457,11 +458,9 @@ team_get_cup_rank(const Team *tm, const CupRound *cupround, gboolean abort)
|
||||
}
|
||||
|
||||
if(abort)
|
||||
{
|
||||
g_warning("team_get_cup_rank: no rank found for team %s. \n ", tm->name);
|
||||
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
}
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"team_get_cup_rank: no rank found for team %s. \n ",
|
||||
tm->name);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -541,8 +540,9 @@ team_attribute_to_char(gint attribute, gint value)
|
||||
switch(attribute)
|
||||
{
|
||||
default:
|
||||
g_warning("team_attribute_to_char: unknown attribute %d\n", attribute);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"team_attribute_to_char: unknown attribute %d\n",
|
||||
attribute);
|
||||
break;
|
||||
case TEAM_ATTRIBUTE_STYLE:
|
||||
switch(value)
|
||||
@ -600,6 +600,7 @@ team_change_attribute_with_message(Team *tm, gint attribute, gint new_value)
|
||||
}
|
||||
}
|
||||
|
||||
/*d remove*/
|
||||
/** Make cpu players healthy etc.
|
||||
@param tm The cpu team.
|
||||
@param reset_fitness Whether to reset the fitness values of playes. */
|
||||
@ -651,6 +652,7 @@ team_update_cpu_corrections(Team *tm, gboolean reset_fitness)
|
||||
}
|
||||
}
|
||||
|
||||
/*d remove*/
|
||||
/** Make some random substitutions in the cpu team. */
|
||||
void
|
||||
team_update_cpu_subs(Team *tm)
|
||||
@ -671,6 +673,7 @@ team_update_cpu_subs(Team *tm)
|
||||
game_substitute_player(tm, 0);
|
||||
}
|
||||
|
||||
/*d remove*/
|
||||
/** Change a cpu team's structure. */
|
||||
void
|
||||
team_update_cpu_structure(Team *tm)
|
||||
@ -705,6 +708,7 @@ team_update_cpu_new_players(Team *tm)
|
||||
}
|
||||
}
|
||||
|
||||
/*d remove*/
|
||||
/** Heal players, re-set fitnesses, make some random subs
|
||||
and replace some players with new ones.
|
||||
@param tm The team we examine.
|
||||
@ -728,12 +732,16 @@ team_update_cpu_team(Team *tm, gboolean reset_fitness)
|
||||
/** Increase player ages etc.
|
||||
@param tm The user team we examine. */
|
||||
void
|
||||
team_update_user_team_weekly(Team *tm)
|
||||
team_update_team_weekly(Team *tm)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=tm->players->len - 1;i>=0;i--)
|
||||
player_update_weekly(&g_array_index(tm->players, Player, i));
|
||||
|
||||
if(team_is_user(tm) == -1 &&
|
||||
math_rnd(0, 1) < const_float("float_team_new_player_probability"))
|
||||
team_update_cpu_new_players(tm);
|
||||
}
|
||||
|
||||
/** Regenerate player fitness etc. after a match.
|
||||
@ -751,12 +759,15 @@ team_update_post_match(Team *tm, const Fixture *fix)
|
||||
/** Some updates each round.
|
||||
@param tm The user team we examine. */
|
||||
void
|
||||
team_update_user_team_week_roundly(Team *tm)
|
||||
team_update_team_week_roundly(Team *tm)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<tm->players->len;i++)
|
||||
player_update_week_roundly(tm, i);
|
||||
|
||||
if(team_is_user(tm) == -1)
|
||||
strategy_update_team_pre_match(tm);
|
||||
}
|
||||
|
||||
/** Return a value from the league table element going with the team.
|
||||
@ -768,13 +779,9 @@ team_get_table_value(const Team *tm, gint type)
|
||||
const GArray *elements = NULL;
|
||||
|
||||
if(tm->clid >= ID_CUP_START)
|
||||
{
|
||||
g_warning("team_get_table_value: team is not a league team: %s \n", tm->name);
|
||||
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
|
||||
return -1;
|
||||
}
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"team_get_table_value: team is not a league team: %s \n",
|
||||
tm->name);
|
||||
|
||||
elements = league_from_clid(tm->clid)->table.elements;
|
||||
|
||||
@ -783,13 +790,9 @@ team_get_table_value(const Team *tm, gint type)
|
||||
break;
|
||||
|
||||
if(i == elements->len)
|
||||
{
|
||||
g_warning("team_get_table_value: table entry not found for team %s \n", tm->name);
|
||||
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
|
||||
return -1;
|
||||
}
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"team_get_table_value: table entry not found for team %s \n",
|
||||
tm->name);
|
||||
|
||||
return g_array_index(elements, TableElement, i).values[type];
|
||||
}
|
||||
@ -951,9 +954,8 @@ team_get_index(const Team *tm)
|
||||
return i;
|
||||
}
|
||||
|
||||
g_warning("team_get_index: team %s not found.\n", tm->name);
|
||||
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"team_get_index: team %s not found.\n", tm->name);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -985,22 +987,26 @@ query_team_plays(const Team *tm, gint week_number, gint week_round_number)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
for(j=0;j<lig(i).fixtures->len;j++)
|
||||
if(g_array_index(lig(i).fixtures, Fixture, j).week_number == week_number &&
|
||||
g_array_index(lig(i).fixtures, Fixture, j).week_round_number == week_round_number &&
|
||||
(g_array_index(lig(i).fixtures, Fixture, j).teams[0] == tm ||
|
||||
g_array_index(lig(i).fixtures, Fixture, j).teams[1] == tm))
|
||||
return TRUE;
|
||||
|
||||
if(tm->clid < ID_CUP_START)
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(lig(i).id == tm->clid)
|
||||
for(j=0;j<lig(i).fixtures->len;j++)
|
||||
if(g_array_index(lig(i).fixtures, Fixture, j).week_number == week_number &&
|
||||
g_array_index(lig(i).fixtures, Fixture, j).week_round_number == week_round_number &&
|
||||
(g_array_index(lig(i).fixtures, Fixture, j).teams[0] == tm ||
|
||||
g_array_index(lig(i).fixtures, Fixture, j).teams[1] == tm))
|
||||
return TRUE;
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
if(g_array_index(acp(i)->fixtures, Fixture, j).week_number == week_number &&
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).week_round_number == week_round_number &&
|
||||
(g_array_index(acp(i)->fixtures, Fixture, j).teams[0] == tm ||
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).teams[1] == tm))
|
||||
return TRUE;
|
||||
|
||||
if(query_cup_is_national(acp(i)->id) ||
|
||||
query_team_is_in_cup(tm, acp(i)))
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
if(g_array_index(acp(i)->fixtures, Fixture, j).week_number == week_number &&
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).week_round_number == week_round_number &&
|
||||
(g_array_index(acp(i)->fixtures, Fixture, j).teams[0] == tm ||
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).teams[1] == tm))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1219,7 +1225,6 @@ team_complete_def_sort(Team *tm)
|
||||
math_get_place(tm->structure, 2),
|
||||
math_get_place(tm->structure, 1)};
|
||||
Player player_tmp, player_tmp2;
|
||||
gchar buf[SMALL];
|
||||
|
||||
for(i=0;i<11;i++)
|
||||
positions[g_array_index(tm->players, Player, i).pos]++;
|
||||
@ -1247,11 +1252,9 @@ team_complete_def_sort(Team *tm)
|
||||
}
|
||||
|
||||
if(j == tm->players->len)
|
||||
{
|
||||
sprintf(buf, "team_complete_def_sort (1): cannot sort according to structure %d (team %s).",
|
||||
tm->structure, tm->name);
|
||||
main_exit_program(EXIT_DEF_SORT, buf);
|
||||
}
|
||||
main_exit_program(EXIT_DEF_SORT,
|
||||
"team_complete_def_sort (1): cannot sort according to structure %d (team %s).",
|
||||
tm->structure, tm->name);
|
||||
|
||||
positions[i]--;
|
||||
positions[player_tmp2.pos]++;
|
||||
@ -1271,11 +1274,9 @@ team_complete_def_sort(Team *tm)
|
||||
}
|
||||
|
||||
if(j == 11)
|
||||
{
|
||||
sprintf(buf, "team_complete_def_sort (2): cannot sort according to structure %d (team %s).",
|
||||
tm->structure, tm->name);
|
||||
main_exit_program(EXIT_DEF_SORT, buf);
|
||||
}
|
||||
main_exit_program(EXIT_DEF_SORT,
|
||||
"team_complete_def_sort (2): cannot sort according to structure %d (team %s).",
|
||||
tm->structure, tm->name);
|
||||
|
||||
for(j=10;j<tm->players->len;j++)
|
||||
if(g_array_index(tm->players, Player, j).pos == i)
|
||||
@ -1286,11 +1287,9 @@ team_complete_def_sort(Team *tm)
|
||||
}
|
||||
|
||||
if(j == tm->players->len)
|
||||
{
|
||||
sprintf(buf, "team_complete_def_sort (3): cannot sort according to structure %d (team %s).",
|
||||
tm->structure, tm->name);
|
||||
main_exit_program(EXIT_DEF_SORT, buf);
|
||||
}
|
||||
main_exit_program(EXIT_DEF_SORT,
|
||||
"team_complete_def_sort (3): cannot sort according to structure %d (team %s).",
|
||||
tm->structure, tm->name);
|
||||
|
||||
positions[i]++;
|
||||
positions[player_tmp.pos]--;
|
||||
@ -1321,3 +1320,12 @@ team_get_table_clid(const Team *tm)
|
||||
|
||||
return tm->clid;
|
||||
}
|
||||
|
||||
const Team*
|
||||
team_get_next_opponent(const Team *tm)
|
||||
{
|
||||
const Fixture *fix = team_get_fixture(tm, FALSE);
|
||||
|
||||
return (fix == NULL) ? NULL :
|
||||
fix->teams[fix->teams[0] == tm];
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ void
|
||||
team_change_attribute_with_message(Team * tm, gint attribute, gint new_value);
|
||||
|
||||
void
|
||||
team_update_user_team_weekly(Team *tm);
|
||||
team_update_team_weekly(Team *tm);
|
||||
|
||||
void
|
||||
team_update_cpu_team(Team *tm, gboolean reset_fitness);
|
||||
@ -123,7 +123,7 @@ void
|
||||
team_update_cpu_new_players(Team *tm);
|
||||
|
||||
void
|
||||
team_update_user_team_week_roundly(Team *tm);
|
||||
team_update_team_week_roundly(Team *tm);
|
||||
|
||||
Team*
|
||||
team_get_new(const Team *tm, gboolean fire);
|
||||
@ -167,4 +167,7 @@ team_complete_def_sort(Team *tm);
|
||||
gint
|
||||
team_get_table_clid(const Team *tm);
|
||||
|
||||
const Team*
|
||||
team_get_next_opponent(const Team *tm);
|
||||
|
||||
#endif
|
||||
|
@ -75,6 +75,8 @@ typedef struct
|
||||
player names from. */
|
||||
gchar *names_file;
|
||||
gchar *def_file;
|
||||
/** The sid of the strategy if it's a CPU team. */
|
||||
gchar *strategy_sid;
|
||||
|
||||
gint clid, /**< Numerical id of the league or cup the team belongs to. */
|
||||
id, /**< Id of the team. */
|
||||
|
@ -1145,8 +1145,12 @@ treeview_create_single_table(GtkListStore *ls, const Table *table, gint number)
|
||||
colour_bg, colour_fg, i + 1);
|
||||
|
||||
treeview_helper_get_table_element_colours(table, i, &colour_fg, &colour_bg, TRUE);
|
||||
sprintf(buf[1], "<span background='%s' foreground='%s'>%s</span>",
|
||||
colour_bg, colour_fg, elem->team->name);
|
||||
if(debug < 50)
|
||||
sprintf(buf[1], "<span background='%s' foreground='%s'>%s</span>",
|
||||
colour_bg, colour_fg, elem->team->name);
|
||||
else
|
||||
sprintf(buf[1], "<span background='%s' foreground='%s'>%s (%s)</span>",
|
||||
colour_bg, colour_fg, elem->team->name, elem->team->strategy_sid);
|
||||
|
||||
gtk_list_store_set(ls, &iter, 1, buf[0], 3, buf[1], -1);
|
||||
|
||||
@ -1568,6 +1572,8 @@ treeview_create_next_opponent(void)
|
||||
if(opp == NULL)
|
||||
return NULL;
|
||||
|
||||
ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
if(fix->clid < ID_CUP_START)
|
||||
strcpy(buf, league_cup_get_name_string(fix->clid));
|
||||
else
|
||||
|
@ -669,7 +669,12 @@ treeview_helper_get_attributes_from_scout(gint scout)
|
||||
attribute.on_off[PLAYER_LIST_ATTRIBUTE_AGE] = TRUE;
|
||||
if(scout < 1)
|
||||
attribute.on_off[PLAYER_LIST_ATTRIBUTE_GAMES] =
|
||||
attribute.on_off[PLAYER_LIST_ATTRIBUTE_GOALS] = TRUE;
|
||||
attribute.on_off[PLAYER_LIST_ATTRIBUTE_GOALS] =
|
||||
attribute.on_off[PLAYER_LIST_ATTRIBUTE_STATUS] =
|
||||
/*d*/
|
||||
attribute.on_off[PLAYER_LIST_ATTRIBUTE_FITNESS] =
|
||||
attribute.on_off[PLAYER_LIST_ATTRIBUTE_CSKILL] =
|
||||
attribute.on_off[PLAYER_LIST_ATTRIBUTE_CPOS] = TRUE;
|
||||
|
||||
return attribute;
|
||||
}
|
||||
@ -1058,7 +1063,10 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col,
|
||||
treeview_helper_player_contract_to_cell(renderer, buf, pl->contract);
|
||||
break;
|
||||
case PLAYER_LIST_ATTRIBUTE_TEAM:
|
||||
sprintf(buf, "%s", pl->team->name);
|
||||
if(debug < 50)
|
||||
sprintf(buf, "%s", pl->team->name);
|
||||
else
|
||||
sprintf(buf, "%s (%s)", pl->team->name, pl->team->strategy_sid);
|
||||
break;
|
||||
case PLAYER_LIST_ATTRIBUTE_LEAGUE_CUP:
|
||||
strcpy(buf, league_cup_get_name_string(pl->team->clid));
|
||||
|
@ -272,10 +272,9 @@ user_from_team(const Team *tm)
|
||||
if(usr(i).tm == tm)
|
||||
return &usr(i);
|
||||
|
||||
g_warning("User going with team %s not found.\n",
|
||||
tm->name);
|
||||
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_POINTER_NOT_FOUND,
|
||||
"User going with team %s not found.\n",
|
||||
tm->name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ OptionList constants;
|
||||
OptionList constants_app;
|
||||
/** Array with internal settings. */
|
||||
OptionList settings;
|
||||
/* Array holding live game tokens. */
|
||||
OptionList lg_tokens;
|
||||
/* Array holding string replacement tokens. */
|
||||
OptionList tokens;
|
||||
|
||||
/** The array containing the live game commentary strings. */
|
||||
GArray *lg_commentary[LIVE_GAME_EVENT_END];
|
||||
@ -68,6 +68,9 @@ GArray *transfer_list;
|
||||
end of each season. */
|
||||
GArray *season_stats;
|
||||
|
||||
/** Array of available CPU strategies. */
|
||||
GArray *strategies;
|
||||
|
||||
/** Some counters we use. */
|
||||
gint counters[COUNT_END];
|
||||
|
||||
|
@ -115,7 +115,8 @@ window_show_startup(void)
|
||||
country_files = file_get_country_files();
|
||||
|
||||
if(country_files->len == 0)
|
||||
main_exit_program(EXIT_NO_COUNTRY_FILES, "Didn't find any country definition files in the support directories.");
|
||||
main_exit_program(EXIT_NO_COUNTRY_FILES,
|
||||
"Didn't find any country definition files in the support directories.");
|
||||
|
||||
gtk_cell_layout_clear(GTK_CELL_LAYOUT(combo_country));
|
||||
|
||||
@ -547,8 +548,8 @@ window_create(gint window_type)
|
||||
switch(window_type)
|
||||
{
|
||||
default:
|
||||
g_warning("window_create: unknown window type %d\n", window_type);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND, NULL);
|
||||
main_exit_program(EXIT_INT_NOT_FOUND,
|
||||
"window_create: unknown window type %d\n", window_type);
|
||||
break;
|
||||
case WINDOW_MAIN:
|
||||
if(window.main == NULL)
|
||||
|
20
src/xml.c
20
src/xml.c
@ -56,10 +56,10 @@ xml_load_users(const gchar *dirname, const gchar *basename)
|
||||
|
||||
for(i=0;i<users->len;i++)
|
||||
{
|
||||
sprintf(buf, "%s/%s___user_%02d_options", dirname, basename, i);
|
||||
sprintf(buf, "%s%s%s___user_%02d_options", dirname, G_DIR_SEPARATOR_S, basename, i);
|
||||
file_load_opt_file(buf, &usr(i).options);
|
||||
|
||||
sprintf(buf, "%s/%s___user_%02d_live_game.xml", dirname, basename, i);
|
||||
sprintf(buf, "%s%s%s___user_%02d_live_game.xml", dirname, G_DIR_SEPARATOR_S, basename, i);
|
||||
xml_loadsave_live_game_read(buf, &usr(i).live_game);
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ xml_load_league(const gchar *dirname, const gchar *basename)
|
||||
League new = league_new(FALSE);
|
||||
gchar *prefix = g_strndup(basename, strlen(basename) - 4);
|
||||
|
||||
sprintf(buf, "%s/%s", dirname, basename);
|
||||
sprintf(buf, "%s%s%s", dirname, G_DIR_SEPARATOR_S, basename);
|
||||
xml_loadsave_league_read(buf, &new);
|
||||
|
||||
g_array_append_val(ligs, new);
|
||||
@ -85,16 +85,16 @@ xml_load_league(const gchar *dirname, const gchar *basename)
|
||||
if(debug > 80)
|
||||
printf("%s\n", buf);
|
||||
|
||||
sprintf(buf, "%s/%s_teams.xml", dirname, prefix);
|
||||
sprintf(buf, "%s%s%s_teams.xml", dirname, G_DIR_SEPARATOR_S, prefix);
|
||||
xml_loadsave_teams_read(buf, lig(ligs->len - 1).teams);
|
||||
|
||||
sprintf(buf, "%s/%s_fixtures.xml", dirname, prefix);
|
||||
sprintf(buf, "%s%s%s_fixtures.xml", dirname, G_DIR_SEPARATOR_S, prefix);
|
||||
xml_loadsave_fixtures_read(buf, lig(ligs->len - 1).fixtures);
|
||||
|
||||
sprintf(buf, "%s/%s_table.xml", dirname, prefix);
|
||||
sprintf(buf, "%s%s%s_table.xml", dirname, G_DIR_SEPARATOR_S, prefix);
|
||||
xml_loadsave_table_read(buf, &lig(ligs->len - 1).table);
|
||||
|
||||
sprintf(buf, "%s/%s_stat.xml", dirname, prefix);
|
||||
sprintf(buf, "%s%s%s_stat.xml", dirname, G_DIR_SEPARATOR_S, prefix);
|
||||
xml_loadsave_league_stat_read(buf, &lig(ligs->len - 1).stats);
|
||||
|
||||
g_free(prefix);
|
||||
@ -106,7 +106,7 @@ xml_load_cup(Cup *cup, const gchar *dirname, const gchar *basename)
|
||||
gchar buf[SMALL];
|
||||
gchar *prefix = g_strndup(basename, strlen(basename) - 4);
|
||||
|
||||
sprintf(buf, "%s/%s", dirname, basename);
|
||||
sprintf(buf, "%s%s%s", dirname, G_DIR_SEPARATOR_S, basename);
|
||||
xml_loadsave_cup_read(buf, cup);
|
||||
|
||||
sprintf(buf, _("Loading cup: %s"),
|
||||
@ -118,7 +118,7 @@ xml_load_cup(Cup *cup, const gchar *dirname, const gchar *basename)
|
||||
if(debug > 80)
|
||||
printf("%s\n", buf);
|
||||
|
||||
sprintf(buf, "%s/%s_fixtures.xml", dirname, prefix);
|
||||
sprintf(buf, "%s%s%s_fixtures.xml", dirname, G_DIR_SEPARATOR_S, prefix);
|
||||
xml_loadsave_fixtures_read(buf, cup->fixtures);
|
||||
|
||||
g_free(prefix);
|
||||
@ -129,7 +129,7 @@ xml_load_transfers(const gchar *dirname, const gchar *basename)
|
||||
{
|
||||
gchar buf[SMALL];
|
||||
|
||||
sprintf(buf, "%s/%s___transfer_list.xml", dirname, basename);
|
||||
sprintf(buf, "%s%s%s___transfer_list.xml", dirname, G_DIR_SEPARATOR_S, basename);
|
||||
|
||||
free_g_array(&transfer_list);
|
||||
transfer_list = g_array_new(FALSE, FALSE, sizeof(Transfer));
|
||||
|
@ -132,7 +132,7 @@ xml_country_read_end_element (GMarkupParseContext *context,
|
||||
state = STATE_CUPS;
|
||||
|
||||
else if(strcmp(element_name, TAG_COUNTRY) != 0)
|
||||
g_warning("xml_country_read_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
g_warning("xml_country_read_end_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
||||
new_round.byes = int_value;
|
||||
else if(state == TAG_CUP_ROUND_TEAMS_FILE)
|
||||
{
|
||||
sprintf(buf2, "%s/%s", dirname, buf);
|
||||
sprintf(buf2, "%s%s%s", dirname, G_DIR_SEPARATOR_S, buf);
|
||||
xml_loadsave_teams_read(buf2, new_round.teams);
|
||||
|
||||
for(i=0;i<new_round.teams->len;i++)
|
||||
@ -253,7 +253,7 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
||||
{
|
||||
new_table = table_new();
|
||||
|
||||
sprintf(buf2, "%s/%s", dirname, buf);
|
||||
sprintf(buf2, "%s%s%s", dirname, G_DIR_SEPARATOR_S, buf);
|
||||
xml_loadsave_table_read(buf2, &new_table);
|
||||
|
||||
g_array_append_val(new_round.tables, new_table);
|
||||
|
@ -118,7 +118,7 @@ xml_loadsave_leagues_cups_read(const gchar *dirname, const gchar *prefix)
|
||||
guint length;
|
||||
GError *error = NULL;
|
||||
|
||||
sprintf(file, "%s/%s___leagues_cups.xml", dirname, prefix);
|
||||
sprintf(file, "%s%s%s___leagues_cups.xml", dirname, G_DIR_SEPARATOR_S, prefix);
|
||||
|
||||
context =
|
||||
g_markup_parse_context_new(&parser, 0, NULL, NULL);
|
||||
|
@ -150,7 +150,7 @@ xml_loadsave_misc_read(const gchar *dirname, const gchar *basename)
|
||||
guint length;
|
||||
GError *error = NULL;
|
||||
|
||||
sprintf(file, "%s/%s___misc.xml", dirname, basename);
|
||||
sprintf(file, "%s%s%s___misc.xml", dirname, G_DIR_SEPARATOR_S, basename);
|
||||
|
||||
context =
|
||||
g_markup_parse_context_new(&parser, 0, NULL, NULL);
|
||||
|
@ -148,7 +148,7 @@ xml_loadsave_season_stats_text (GMarkupParseContext *context,
|
||||
else if(state == TAG_LEAGUE_STAT_FILE)
|
||||
{
|
||||
new_league_stat = stat_league_new(-1);
|
||||
sprintf(buf2, "%s/%s", dirname2, buf);
|
||||
sprintf(buf2, "%s%s%s", dirname2, G_DIR_SEPARATOR_S, buf);
|
||||
xml_loadsave_league_stat_read(buf2, &new_league_stat);
|
||||
g_array_append_val(new_season_stat.league_stats, new_league_stat);
|
||||
}
|
||||
@ -169,7 +169,7 @@ xml_loadsave_season_stats_read(const gchar *dirname, const gchar *prefix)
|
||||
context =
|
||||
g_markup_parse_context_new(&parser, 0, NULL, NULL);
|
||||
|
||||
sprintf(filename, "%s/%s___season_stats.xml", dirname, prefix);
|
||||
sprintf(filename, "%s%s%s___season_stats.xml", dirname, G_DIR_SEPARATOR_S, prefix);
|
||||
|
||||
if(!g_file_get_contents(filename, &file_contents, &length, &error))
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ enum
|
||||
TAG_TEAM_STYLE,
|
||||
TAG_TEAM_BOOST,
|
||||
TAG_TEAM_CLID,
|
||||
TAG_TEAM_STRATEGY_SID,
|
||||
TAG_TEAM_STADIUM,
|
||||
TAG_TEAM_STADIUM_NAME,
|
||||
TAG_TEAM_STADIUM_CAPACITY,
|
||||
@ -113,6 +114,7 @@ xml_loadsave_teams_end_element (GMarkupParseContext *context,
|
||||
tag == TAG_TEAM_NAMES_FILE ||
|
||||
tag == TAG_TEAM_ID ||
|
||||
tag == TAG_TEAM_CLID ||
|
||||
tag == TAG_TEAM_STRATEGY_SID ||
|
||||
tag == TAG_TEAM_STRUCTURE ||
|
||||
tag == TAG_TEAM_STYLE ||
|
||||
tag == TAG_TEAM_BOOST ||
|
||||
@ -161,6 +163,8 @@ xml_loadsave_teams_text (GMarkupParseContext *context,
|
||||
misc_string_assign(&new_team.names_file, buf);
|
||||
else if(state == TAG_TEAM_CLID)
|
||||
new_team.clid = int_value;
|
||||
else if(state == TAG_TEAM_STRATEGY_SID)
|
||||
misc_string_assign(&new_team.strategy_sid, buf);
|
||||
else if(state == TAG_TEAM_ID)
|
||||
new_team.id = int_value;
|
||||
else if(state == TAG_TEAM_STRUCTURE)
|
||||
@ -251,13 +255,14 @@ xml_loadsave_teams_write_team(FILE *fil, const Team* team)
|
||||
xml_write_string(fil, team->name, TAG_NAME, I1);
|
||||
xml_write_string(fil, team->symbol, TAG_SYMBOL, I1);
|
||||
xml_write_string(fil, team->names_file, TAG_TEAM_NAMES_FILE, I1);
|
||||
|
||||
xml_write_string(fil, team->strategy_sid, TAG_TEAM_STRATEGY_SID, I1);
|
||||
|
||||
xml_write_int(fil, team->clid, TAG_TEAM_CLID, I1);
|
||||
xml_write_int(fil, team->id, TAG_TEAM_ID, I1);
|
||||
xml_write_int(fil, team->structure, TAG_TEAM_STRUCTURE, I1);
|
||||
xml_write_int(fil, team->style, TAG_TEAM_STYLE, I1);
|
||||
xml_write_int(fil, team->boost, TAG_TEAM_BOOST, I1);
|
||||
|
||||
|
||||
fprintf(fil, "%s<_%d>\n", I1, TAG_TEAM_STADIUM);
|
||||
|
||||
if(team->stadium.name != NULL)
|
||||
|
@ -305,7 +305,7 @@ xml_loadsave_users_read(const gchar *dirname, const gchar *basename)
|
||||
GError *error = NULL;
|
||||
gchar file[SMALL];
|
||||
|
||||
sprintf(file, "%s/%s___users.xml", dirname, basename);
|
||||
sprintf(file, "%s%s%s___users.xml", dirname, G_DIR_SEPARATOR_S, basename);
|
||||
|
||||
context =
|
||||
g_markup_parse_context_new(&parser, 0, NULL, NULL);
|
||||
|
560
src/xml_strategy.c
Normal file
560
src/xml_strategy.c
Normal file
@ -0,0 +1,560 @@
|
||||
/*
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "file.h"
|
||||
#include "free.h"
|
||||
#include "main.h"
|
||||
#include "misc.h"
|
||||
#include "strategy_struct.h"
|
||||
#include "xml_strategy.h"
|
||||
|
||||
#define TAG_STRATEGY "strategy"
|
||||
#define TAG_STRATEGY_SID "sid"
|
||||
#define TAG_STRATEGY_DESC "desc"
|
||||
#define TAG_STRATEGY_PRIORITY "priority"
|
||||
|
||||
#define TAG_STRATEGY_PREMATCH "prematch"
|
||||
#define TAG_STRATEGY_PREMATCH_FORMATION "formation"
|
||||
#define TAG_STRATEGY_PREMATCH_LINEUP "lineup"
|
||||
#define TAG_STRATEGY_PREMATCH_BOOST "prematch_boost"
|
||||
#define TAG_STRATEGY_PREMATCH_STYLE "prematch_style"
|
||||
|
||||
#define TAG_STRATEGY_MATCH_ACTION "match_action"
|
||||
#define TAG_STRATEGY_MATCH_ACTION_BOOST "boost"
|
||||
#define TAG_STRATEGY_MATCH_ACTION_STYLE "style"
|
||||
#define TAG_STRATEGY_MATCH_ACTION_SUB "sub"
|
||||
#define TAG_STRATEGY_MATCH_ACTION_SUB_IN_POS "in"
|
||||
#define TAG_STRATEGY_MATCH_ACTION_SUB_OUT_POS "out"
|
||||
|
||||
#define ATT_NAME_MIN_FITNESS "min_fitness"
|
||||
#define ATT_NAME_COND "cond"
|
||||
#define ATT_NAME_SUB_PROPERTY "prop"
|
||||
|
||||
#define LINEUP_NAME_BEST "best"
|
||||
#define LINEUP_NAME_WEAKEST "weakest"
|
||||
#define LINEUP_NAME_FITTEST "fittest"
|
||||
#define LINEUP_NAME_UNFITTEST "unfittest"
|
||||
|
||||
#define BOOST_NAME_ON "on"
|
||||
#define BOOST_NAME_OFF "off"
|
||||
#define BOOST_NAME_ANTI "anti"
|
||||
|
||||
#define STYLE_NAME_ALL_OUT_DEFEND "all-out-defend"
|
||||
#define STYLE_NAME_DEFEND "defend"
|
||||
#define STYLE_NAME_BALANCED "balanced"
|
||||
#define STYLE_NAME_ATTACK "attack"
|
||||
#define STYLE_NAME_ALL_OUT_ATTACK "all-out-attack"
|
||||
|
||||
#define POS_NAME_GOALIE "goalie"
|
||||
#define POS_NAME_DEFENDER "defender"
|
||||
#define POS_NAME_MIDFIELDER "midfielder"
|
||||
#define POS_NAME_FORWARD "forward"
|
||||
|
||||
enum
|
||||
{
|
||||
STATE_STRATEGY = 0,
|
||||
STATE_STRATEGY_SID,
|
||||
STATE_STRATEGY_DESC,
|
||||
STATE_STRATEGY_PRIORITY,
|
||||
STATE_STRATEGY_PREMATCH,
|
||||
STATE_STRATEGY_PREMATCH_FORMATION,
|
||||
STATE_STRATEGY_PREMATCH_LINEUP,
|
||||
STATE_STRATEGY_PREMATCH_BOOST,
|
||||
STATE_STRATEGY_PREMATCH_STYLE,
|
||||
STATE_STRATEGY_MATCH_ACTION,
|
||||
STATE_STRATEGY_MATCH_ACTION_BOOST,
|
||||
STATE_STRATEGY_MATCH_ACTION_STYLE,
|
||||
STATE_STRATEGY_MATCH_ACTION_SUB,
|
||||
STATE_STRATEGY_MATCH_ACTION_SUB_IN_POS,
|
||||
STATE_STRATEGY_MATCH_ACTION_SUB_OUT_POS,
|
||||
};
|
||||
|
||||
gint state;
|
||||
|
||||
#define curstrat g_array_index(strategies, Strategy, strategies->len - 1)
|
||||
#define curprematch g_array_index(curstrat.prematch, StrategyPrematch, curstrat.prematch->len - 1)
|
||||
#define curmatchaction g_array_index(curstrat.match_action, StrategyMatchAction, curstrat.match_action->len - 1)
|
||||
|
||||
void
|
||||
xml_strategy_read_start_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
const gchar **attribute_names,
|
||||
const gchar **attribute_values,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
gint atidx = 0;
|
||||
|
||||
if(strcmp(element_name, TAG_STRATEGY) == 0)
|
||||
state = STATE_STRATEGY;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_SID) == 0)
|
||||
state = STATE_STRATEGY_SID;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_DESC) == 0)
|
||||
state = STATE_STRATEGY_DESC;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_PRIORITY) == 0)
|
||||
state = STATE_STRATEGY_PRIORITY;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_PREMATCH) == 0)
|
||||
{
|
||||
StrategyPrematch new_prematch;
|
||||
|
||||
state = STATE_STRATEGY_PREMATCH;
|
||||
|
||||
new_prematch.condition = NULL;
|
||||
new_prematch.lineup = new_prematch.boost =
|
||||
new_prematch.style = -100;
|
||||
new_prematch.min_fitness = 0;
|
||||
new_prematch.formations = g_array_new(FALSE, FALSE, sizeof(gint));
|
||||
|
||||
while(attribute_names[atidx] != NULL)
|
||||
{
|
||||
if(strcmp(attribute_names[atidx], ATT_NAME_COND) == 0)
|
||||
new_prematch.condition =
|
||||
g_strdup(attribute_values[atidx]);
|
||||
else
|
||||
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
|
||||
attribute_names[atidx]);
|
||||
|
||||
atidx++;
|
||||
}
|
||||
|
||||
g_array_append_val(curstrat.prematch, new_prematch);
|
||||
}
|
||||
else if(strcmp(element_name, TAG_STRATEGY_PREMATCH_FORMATION) == 0)
|
||||
state = STATE_STRATEGY_PREMATCH_FORMATION;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_PREMATCH_LINEUP) == 0)
|
||||
{
|
||||
state = STATE_STRATEGY_PREMATCH_LINEUP;
|
||||
|
||||
while(attribute_names[atidx] != NULL)
|
||||
{
|
||||
if(strcmp(attribute_names[atidx], ATT_NAME_MIN_FITNESS) == 0)
|
||||
curprematch.min_fitness =
|
||||
g_ascii_strtod(attribute_values[atidx], NULL) / 100;
|
||||
else
|
||||
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
|
||||
attribute_names[atidx]);
|
||||
|
||||
atidx++;
|
||||
}
|
||||
}
|
||||
else if(strcmp(element_name, TAG_STRATEGY_PREMATCH_BOOST) == 0)
|
||||
state = STATE_STRATEGY_PREMATCH_BOOST;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_PREMATCH_STYLE) == 0)
|
||||
state = STATE_STRATEGY_PREMATCH_STYLE;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_MATCH_ACTION) == 0)
|
||||
{
|
||||
StrategyMatchAction new_match_action;
|
||||
|
||||
state = STATE_STRATEGY_MATCH_ACTION;
|
||||
|
||||
new_match_action.condition = NULL;
|
||||
new_match_action.boost =
|
||||
new_match_action.style = -100;
|
||||
new_match_action.sub_in_pos = -1;
|
||||
|
||||
while(attribute_names[atidx] != NULL)
|
||||
{
|
||||
if(strcmp(attribute_names[atidx], ATT_NAME_COND) == 0)
|
||||
new_match_action.condition =
|
||||
g_strdup(attribute_values[atidx]);
|
||||
else
|
||||
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
|
||||
attribute_names[atidx]);
|
||||
|
||||
atidx++;
|
||||
}
|
||||
|
||||
g_array_append_val(curstrat.match_action, new_match_action);
|
||||
}
|
||||
else if(strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_BOOST) == 0)
|
||||
state = STATE_STRATEGY_MATCH_ACTION_BOOST;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_STYLE) == 0)
|
||||
state = STATE_STRATEGY_MATCH_ACTION_STYLE;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_SUB) == 0)
|
||||
state = STATE_STRATEGY_MATCH_ACTION_SUB;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_SUB_IN_POS) == 0)
|
||||
{
|
||||
state = STATE_STRATEGY_MATCH_ACTION_SUB_IN_POS;
|
||||
|
||||
while(attribute_names[atidx] != NULL)
|
||||
{
|
||||
if(strcmp(attribute_names[atidx], ATT_NAME_SUB_PROPERTY) == 0)
|
||||
{
|
||||
if(strcmp(attribute_values[atidx], LINEUP_NAME_BEST) == 0)
|
||||
curmatchaction.sub_in_prop = STRAT_LINEUP_BEST;
|
||||
else if(strcmp(attribute_values[atidx], LINEUP_NAME_WEAKEST) == 0)
|
||||
curmatchaction.sub_in_prop = STRAT_LINEUP_WEAKEST;
|
||||
else if(strcmp(attribute_values[atidx], LINEUP_NAME_FITTEST) == 0)
|
||||
curmatchaction.sub_in_prop = STRAT_LINEUP_FITTEST;
|
||||
else if(strcmp(attribute_values[atidx], LINEUP_NAME_UNFITTEST) == 0)
|
||||
curmatchaction.sub_in_prop = STRAT_LINEUP_UNFITTEST;
|
||||
else
|
||||
g_warning("xml_strategy_read_start_element: unknown property value %s\n",
|
||||
attribute_values[atidx]);
|
||||
}
|
||||
else
|
||||
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
|
||||
attribute_names[atidx]);
|
||||
|
||||
atidx++;
|
||||
}
|
||||
}
|
||||
else if(strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_SUB_OUT_POS) == 0)
|
||||
{
|
||||
state = STATE_STRATEGY_MATCH_ACTION_SUB_OUT_POS;
|
||||
|
||||
while(attribute_names[atidx] != NULL)
|
||||
{
|
||||
if(strcmp(attribute_names[atidx], ATT_NAME_SUB_PROPERTY) == 0)
|
||||
{
|
||||
if(strcmp(attribute_values[atidx], LINEUP_NAME_BEST) == 0)
|
||||
curmatchaction.sub_out_prop = STRAT_LINEUP_BEST;
|
||||
else if(strcmp(attribute_values[atidx], LINEUP_NAME_WEAKEST) == 0)
|
||||
curmatchaction.sub_out_prop = STRAT_LINEUP_WEAKEST;
|
||||
else if(strcmp(attribute_values[atidx], LINEUP_NAME_FITTEST) == 0)
|
||||
curmatchaction.sub_out_prop = STRAT_LINEUP_FITTEST;
|
||||
else if(strcmp(attribute_values[atidx], LINEUP_NAME_UNFITTEST) == 0)
|
||||
curmatchaction.sub_out_prop = STRAT_LINEUP_UNFITTEST;
|
||||
else
|
||||
g_warning("xml_strategy_read_start_element: unknown property value %s\n",
|
||||
attribute_values[atidx]);
|
||||
}
|
||||
else
|
||||
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
|
||||
attribute_names[atidx]);
|
||||
|
||||
atidx++;
|
||||
}
|
||||
}
|
||||
else
|
||||
g_warning("xml_strategy_read_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* The function called by the parser when a closing tag is read.
|
||||
* The state variable is changed in this function.
|
||||
* @see The GLib manual (Simple XML parser).
|
||||
*/
|
||||
void
|
||||
xml_strategy_read_end_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
if(strcmp(element_name, TAG_STRATEGY_SID) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_DESC) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_PRIORITY) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_MATCH_ACTION) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_PREMATCH) == 0)
|
||||
state = STATE_STRATEGY;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_PREMATCH_FORMATION) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_PREMATCH_LINEUP) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_PREMATCH_BOOST) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_PREMATCH_STYLE) == 0)
|
||||
state = STATE_STRATEGY_PREMATCH;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_SUB) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_STYLE) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_BOOST) == 0)
|
||||
state = STATE_STRATEGY_MATCH_ACTION;
|
||||
else if(strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_SUB_IN_POS) == 0 ||
|
||||
strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_SUB_OUT_POS) == 0)
|
||||
state = STATE_STRATEGY_MATCH_ACTION_SUB;
|
||||
else if(strcmp(element_name, TAG_STRATEGY) != 0)
|
||||
g_warning("xml_strategy_read_end_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* The function called by the parser when the text between tags is read.
|
||||
* This function is responsible for filling in the variables (e.g. team names)
|
||||
* when a file gets loaded.
|
||||
* @see The GLib manual (Simple XML parser).
|
||||
*/
|
||||
void
|
||||
xml_strategy_read_text (GMarkupParseContext *context,
|
||||
const gchar *text,
|
||||
gsize text_len,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
gchar buf[text_len + 1];
|
||||
gint int_value;
|
||||
|
||||
strncpy(buf, text, text_len);
|
||||
buf[text_len] = '\0';
|
||||
|
||||
int_value = (gint)g_ascii_strtod(buf, NULL);
|
||||
|
||||
if(state == STATE_STRATEGY_SID)
|
||||
misc_string_assign(&curstrat.sid, buf);
|
||||
else if(state == STATE_STRATEGY_DESC)
|
||||
misc_string_assign(&curstrat.desc, buf);
|
||||
else if(state == STATE_STRATEGY_PRIORITY)
|
||||
{
|
||||
if(strategies->len == 1)
|
||||
curstrat.priority = int_value;
|
||||
else
|
||||
curstrat.priority =
|
||||
g_array_index(strategies, Strategy, strategies->len - 2).priority +
|
||||
int_value;
|
||||
}
|
||||
else if(state == STATE_STRATEGY_PREMATCH_FORMATION)
|
||||
g_array_append_val(curprematch.formations, int_value);
|
||||
else if(state == STATE_STRATEGY_PREMATCH_LINEUP)
|
||||
{
|
||||
if(strcmp(buf, LINEUP_NAME_BEST) == 0)
|
||||
curprematch.lineup = STRAT_LINEUP_BEST;
|
||||
else if(strcmp(buf, LINEUP_NAME_WEAKEST) == 0)
|
||||
curprematch.lineup = STRAT_LINEUP_WEAKEST;
|
||||
else if(strcmp(buf, LINEUP_NAME_FITTEST) == 0)
|
||||
curprematch.lineup = STRAT_LINEUP_FITTEST;
|
||||
else
|
||||
g_warning(
|
||||
"xml_strategy_read_text: unknown lineup type %s\n", buf);
|
||||
}
|
||||
else if(state == STATE_STRATEGY_PREMATCH_BOOST)
|
||||
{
|
||||
if(strcmp(buf, BOOST_NAME_ON) == 0)
|
||||
curprematch.boost = 1;
|
||||
else if(strcmp(buf, BOOST_NAME_OFF) == 0)
|
||||
curprematch.boost = 0;
|
||||
else if(strcmp(buf, BOOST_NAME_ANTI) == 0)
|
||||
curprematch.boost = -1;
|
||||
else
|
||||
g_warning(
|
||||
"xml_strategy_read_text: unknown boost type %s\n", buf);
|
||||
}
|
||||
else if(state == STATE_STRATEGY_PREMATCH_STYLE)
|
||||
{
|
||||
if(strcmp(buf, STYLE_NAME_ALL_OUT_DEFEND) == 0)
|
||||
curprematch.style = -2;
|
||||
else if(strcmp(buf, STYLE_NAME_DEFEND) == 0)
|
||||
curprematch.style = -1;
|
||||
else if(strcmp(buf, STYLE_NAME_BALANCED) == 0)
|
||||
curprematch.style = 0;
|
||||
else if(strcmp(buf, STYLE_NAME_ATTACK) == 0)
|
||||
curprematch.style = 1;
|
||||
else if(strcmp(buf, STYLE_NAME_ALL_OUT_ATTACK) == 0)
|
||||
curprematch.style = 2;
|
||||
else
|
||||
g_warning(
|
||||
"xml_strategy_read_text: unknown style type %s\n", buf);
|
||||
}
|
||||
else if(state == STATE_STRATEGY_MATCH_ACTION_STYLE)
|
||||
{
|
||||
if(strcmp(buf, STYLE_NAME_ALL_OUT_DEFEND) == 0)
|
||||
curmatchaction.style = -2;
|
||||
else if(strcmp(buf, STYLE_NAME_DEFEND) == 0)
|
||||
curmatchaction.style = -1;
|
||||
else if(strcmp(buf, STYLE_NAME_BALANCED) == 0)
|
||||
curmatchaction.style = 0;
|
||||
else if(strcmp(buf, STYLE_NAME_ATTACK) == 0)
|
||||
curmatchaction.style = 1;
|
||||
else if(strcmp(buf, STYLE_NAME_ALL_OUT_ATTACK) == 0)
|
||||
curmatchaction.style = 2;
|
||||
else
|
||||
g_warning(
|
||||
"xml_strategy_read_text: unknown style type %s\n", buf);
|
||||
}
|
||||
else if(state == STATE_STRATEGY_MATCH_ACTION_BOOST)
|
||||
{
|
||||
if(strcmp(buf, BOOST_NAME_ON) == 0)
|
||||
curmatchaction.boost = 1;
|
||||
else if(strcmp(buf, BOOST_NAME_OFF) == 0)
|
||||
curmatchaction.boost = 0;
|
||||
else if(strcmp(buf, BOOST_NAME_ANTI) == 0)
|
||||
curmatchaction.boost = -1;
|
||||
else
|
||||
g_warning(
|
||||
"xml_strategy_read_text: unknown boost type %s\n", buf);
|
||||
}
|
||||
else if(state == STATE_STRATEGY_MATCH_ACTION_SUB_IN_POS)
|
||||
{
|
||||
if(strcmp(buf, POS_NAME_GOALIE) == 0)
|
||||
curmatchaction.sub_in_pos = 0;
|
||||
else if(strcmp(buf, POS_NAME_DEFENDER) == 0)
|
||||
curmatchaction.sub_in_pos = 1;
|
||||
else if(strcmp(buf, POS_NAME_MIDFIELDER) == 0)
|
||||
curmatchaction.sub_in_pos = 2;
|
||||
else if(strcmp(buf, POS_NAME_FORWARD) == 0)
|
||||
curmatchaction.sub_in_pos = 3;
|
||||
else
|
||||
g_warning(
|
||||
"xml_strategy_read_text: unknown position %s\n", buf);
|
||||
}
|
||||
else if(state == STATE_STRATEGY_MATCH_ACTION_SUB_OUT_POS)
|
||||
{
|
||||
if(strcmp(buf, POS_NAME_GOALIE) == 0)
|
||||
curmatchaction.sub_out_pos = 0;
|
||||
else if(strcmp(buf, POS_NAME_DEFENDER) == 0)
|
||||
curmatchaction.sub_out_pos = 1;
|
||||
else if(strcmp(buf, POS_NAME_MIDFIELDER) == 0)
|
||||
curmatchaction.sub_out_pos = 2;
|
||||
else if(strcmp(buf, POS_NAME_FORWARD) == 0)
|
||||
curmatchaction.sub_out_pos = 3;
|
||||
else
|
||||
g_warning(
|
||||
"xml_strategy_read_text: unknown position %s\n", buf);
|
||||
}
|
||||
}
|
||||
|
||||
/** Add the strategy described in the file
|
||||
to the strategies array. */
|
||||
void
|
||||
xml_strategy_read(const gchar *filename)
|
||||
{
|
||||
gint i;
|
||||
Strategy new_strat;
|
||||
GMarkupParser parser = {xml_strategy_read_start_element,
|
||||
xml_strategy_read_end_element,
|
||||
xml_strategy_read_text, NULL, NULL};
|
||||
GMarkupParseContext *context;
|
||||
gchar *file_contents;
|
||||
gint length;
|
||||
GError *error = NULL;
|
||||
|
||||
context =
|
||||
g_markup_parse_context_new(&parser, 0, NULL, NULL);
|
||||
|
||||
if(!g_file_get_contents(filename, &file_contents, &length, &error))
|
||||
{
|
||||
g_warning("xml_strategy_read: error reading file %s\n", filename);
|
||||
misc_print_error(&error, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
new_strat.sid = new_strat.desc = NULL;
|
||||
new_strat.priority = 1;
|
||||
new_strat.prematch = g_array_new(FALSE, FALSE, sizeof(StrategyPrematch));
|
||||
new_strat.match_action = g_array_new(FALSE, FALSE, sizeof(StrategyMatchAction));
|
||||
|
||||
g_array_append_val(strategies, new_strat);
|
||||
|
||||
if(g_markup_parse_context_parse(context, file_contents, length, &error))
|
||||
{
|
||||
g_markup_parse_context_end_parse(context, NULL);
|
||||
g_markup_parse_context_free(context);
|
||||
g_free(file_contents);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_critical("xml_strategy_read: error parsing file %s\n", filename);
|
||||
misc_print_error(&error, TRUE);
|
||||
}
|
||||
|
||||
|
||||
for(i=0;i<curstrat.match_action->len;i++)
|
||||
{
|
||||
if(g_array_index(curstrat.match_action, StrategyMatchAction, i).condition == NULL)
|
||||
main_exit_program(EXIT_STRATEGY_ERROR, "xml_strategy_read: unconditional match action encountered in file %s. match actions MUST have conditions.", filename);
|
||||
|
||||
/* /\*d*\/ */
|
||||
/* printf("bo %d st %d subinpos %d subinprop %d suboutpos %d suboutprop %d\n", */
|
||||
/* g_array_index(curstrat.match_action, StrategyMatchAction, i).boost, */
|
||||
/* g_array_index(curstrat.match_action, StrategyMatchAction, i).style, */
|
||||
/* g_array_index(curstrat.match_action, StrategyMatchAction, i).sub_in_pos, */
|
||||
/* g_array_index(curstrat.match_action, StrategyMatchAction, i).sub_in_prop, */
|
||||
/* g_array_index(curstrat.match_action, StrategyMatchAction, i).sub_out_pos, */
|
||||
/* g_array_index(curstrat.match_action, StrategyMatchAction, i).sub_out_prop); */
|
||||
}
|
||||
}
|
||||
|
||||
/** Load all strategy files found in the appropriate folder. */
|
||||
void
|
||||
xml_strategy_load_strategies(void)
|
||||
{
|
||||
gint i, j, k;
|
||||
GList *elem = support_directories;
|
||||
const gchar *strategydir = NULL;
|
||||
GPtrArray *files = NULL;
|
||||
gchar buf[SMALL];
|
||||
|
||||
while (elem)
|
||||
{
|
||||
if(g_str_has_suffix((gchar*)elem->data, "strategy"))
|
||||
{
|
||||
strategydir = (const gchar*)elem->data;
|
||||
break;
|
||||
}
|
||||
elem = elem->next;
|
||||
}
|
||||
|
||||
if(strategydir == NULL)
|
||||
main_exit_program(EXIT_STRATEGY_ERROR,
|
||||
"xml_strategy_load_strategies: strategy directory not found.");
|
||||
|
||||
files = file_dir_get_contents(strategydir, "strategy_", ".xml");
|
||||
|
||||
if(files->len == 0)
|
||||
{
|
||||
g_ptr_array_free(files, TRUE);
|
||||
main_exit_program(EXIT_STRATEGY_ERROR,
|
||||
"xml_strategy_load_strategies: no CPU strategies found.");
|
||||
}
|
||||
|
||||
for(i=0;i<files->len;i++)
|
||||
{
|
||||
sprintf(buf, "%s%s%s", strategydir, G_DIR_SEPARATOR_S,
|
||||
(const gchar*)g_ptr_array_index(files, i));
|
||||
xml_strategy_read(buf);
|
||||
}
|
||||
|
||||
free_gchar_array(&files);
|
||||
|
||||
/* Fill secondary prematches with default values. */
|
||||
for(i=0;i<strategies->len;i++)
|
||||
{
|
||||
StrategyPrematch *prem0 = &g_array_index(
|
||||
g_array_index(strategies, Strategy, i).prematch,
|
||||
StrategyPrematch, 0),
|
||||
*premcur = NULL;
|
||||
|
||||
if(prem0->formations->len == 0)
|
||||
main_exit_program(EXIT_STRATEGY_ERROR,
|
||||
"xml_strategy_read (%s): The primary prematch should have at least one formation.",
|
||||
g_array_index(strategies, Strategy, i).sid);
|
||||
|
||||
for(j=1;j<g_array_index(strategies, Strategy, i).prematch->len;j++)
|
||||
{
|
||||
premcur = &g_array_index(
|
||||
g_array_index(strategies, Strategy, i).prematch,
|
||||
StrategyPrematch, j);
|
||||
|
||||
if(premcur->formations->len == 0)
|
||||
for(k=0;k<prem0->formations->len;k++)
|
||||
g_array_append_val(premcur->formations,
|
||||
g_array_index(prem0->formations, gint, k));
|
||||
|
||||
|
||||
if(premcur->boost == -100)
|
||||
premcur->boost = prem0->boost;
|
||||
if(premcur->style == -100)
|
||||
premcur->style = prem0->style;
|
||||
if(premcur->lineup == -100)
|
||||
premcur->lineup = prem0->lineup;
|
||||
if(premcur->min_fitness == -100)
|
||||
premcur->min_fitness = prem0->min_fitness;
|
||||
}
|
||||
}
|
||||
}
|
58
src/xml_strategy.h
Normal file
58
src/xml_strategy.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Bygfoot Football Manager -- a small and simple GTK2-based
|
||||
football management game.
|
||||
|
||||
http://bygfoot.sourceforge.net
|
||||
|
||||
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef XML_STRATEGY_H
|
||||
#define XML_STRATEGY_H
|
||||
|
||||
#include "bygfoot.h"
|
||||
#include "variables.h"
|
||||
|
||||
void
|
||||
xml_strategy_read_start_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
const gchar **attribute_names,
|
||||
const gchar **attribute_values,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
void
|
||||
xml_strategy_read_end_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
void
|
||||
xml_strategy_read_text (GMarkupParseContext *context,
|
||||
const gchar *text,
|
||||
gsize text_len,
|
||||
gpointer user_data,
|
||||
GError **error);
|
||||
|
||||
void
|
||||
xml_strategy_read(const gchar *filename);
|
||||
|
||||
void
|
||||
xml_strategy_load_strategies(void);
|
||||
|
||||
#endif
|
||||
|
@ -129,8 +129,6 @@ xml_team_read_end_element (GMarkupParseContext *context,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
gchar buf[SMALL];
|
||||
|
||||
if(strcmp(element_name, TAG_TEAM_NAME) == 0 ||
|
||||
strcmp(element_name, TAG_STADIUM_NAME) == 0 ||
|
||||
strcmp(element_name, TAG_SYMBOL) == 0 ||
|
||||
@ -145,9 +143,9 @@ xml_team_read_end_element (GMarkupParseContext *context,
|
||||
if(team->players->len == const_int("int_team_cpu_players"))
|
||||
{
|
||||
free_player(&new_player);
|
||||
sprintf(buf, "xml_team_read_end_element: too many players in team definition '%s' (only %d allowed).",
|
||||
d_file, const_int("int_team_cpu_players"));
|
||||
main_exit_program(EXIT_LOAD_TEAM_DEF, buf);
|
||||
main_exit_program(EXIT_LOAD_TEAM_DEF,
|
||||
"xml_team_read_end_element: too many players in team definition '%s' (only %d allowed).",
|
||||
d_file, const_int("int_team_cpu_players"));
|
||||
}
|
||||
else
|
||||
g_array_append_val(team->players, new_player);
|
||||
|
@ -335,8 +335,8 @@ int_game_gui_live_game_speed_max 3500010
|
||||
# factor changing the speed when penalties
|
||||
float_game_gui_live_game_speed_penalties_factor 200000
|
||||
|
||||
# How much a player's skill can deviate from
|
||||
# the average skill in his team.
|
||||
# How much a player's talent can deviate from
|
||||
# the average talent in his team.
|
||||
float_player_average_talent_variance 7500
|
||||
|
||||
# these determine the value calculation of players.
|
||||
@ -721,9 +721,9 @@ int_name_max_product 2000
|
||||
# list instead of the specified one
|
||||
float_name_random_list_prob 20000
|
||||
|
||||
string_language_names English Deutsch Français Spanish Nederlands Polski Romanian Bulgarian Chinese
|
||||
string_language_codes C de fr es nl pl ro bg zh
|
||||
string_language_symbols flag_england.png flag_germany.png flag_france.png flag_spain.png flag_netherlands.png flag_poland.png flag_romania.png flag_bulgaria.png flag_china.png
|
||||
string_language_names English Deutsch Français Spanish Nederlands Polski Danish Romanian Bulgarian Chinese
|
||||
string_language_codes C de fr es nl pl da ro bg zh
|
||||
string_language_symbols flag_england.png flag_germany.png flag_france.png flag_spain.png flag_netherlands.png flag_poland.png flag_dk.png flag_romania.png flag_bulgaria.png flag_china.png
|
||||
|
||||
# lower and upper limits of which percentage
|
||||
# of the player wages a sponsor pays; the actual
|
||||
|
@ -29,7 +29,8 @@ string_contrib_title Translations
|
||||
string_contrib_entry Alexandre Beraud (French)
|
||||
string_contrib_entry Győző Both (German)
|
||||
string_contrib_entry Tobe & Arne Deprez (Dutch)
|
||||
string_contrib_entry Marcelo Garrone (Spanish)
|
||||
string_contrib_entry Marcelo Garrone, Carlos Garces (Spanish)
|
||||
string_contrib_entry Kristian Poul Herkild (Danish)
|
||||
string_contrib_entry Benyuan Liu (Chinese)
|
||||
string_contrib_entry Rostislav "zbrox" Raykov (Bulgarian)
|
||||
string_contrib_entry Michal Rudolf (Polish)
|
||||
|
@ -1,70 +0,0 @@
|
||||
#################
|
||||
# tokens for the live game commentary
|
||||
##################
|
||||
|
||||
#todo minutes total, avskills
|
||||
|
||||
# see
|
||||
# http://bygfoot.sourceforge.net/doc/1.9/definitions_howto.html
|
||||
|
||||
# tokens in the live game commentary
|
||||
|
||||
# general
|
||||
string_lg_commentary_token_league_cup_name _LEAGUECUPNAME_
|
||||
string_lg_commentary_token_cup_round_name _CUPROUNDNAME_
|
||||
string_lg_commentary_token_attendance _AT_
|
||||
string_lg_commentary_token_result _RE_
|
||||
string_lg_commentary_token_time _TIME_
|
||||
string_lg_commentary_token_minute _MI_
|
||||
string_lg_commentary_token_minute_remaining _MR_
|
||||
string_lg_commentary_token_minute_total _MT_
|
||||
string_lg_commentary_token_yellow_limit _YELLOWLIMIT_
|
||||
string_lg_commentary_token_goals0 _GOALS0_
|
||||
string_lg_commentary_token_goals1 _GOALS1_
|
||||
string_lg_commentary_token_goal_diff _GD_
|
||||
string_lg_commentary_token_possession _POSS_
|
||||
string_lg_commentary_token_no_possession _NPOSS_
|
||||
|
||||
# misc
|
||||
string_lg_commentary_token_extra _EX_
|
||||
|
||||
# team
|
||||
string_lg_commentary_token_team_home _T0_
|
||||
string_lg_commentary_token_team_away _T1_
|
||||
string_lg_commentary_token_team_losing _TL_
|
||||
string_lg_commentary_token_team_winning _TW_
|
||||
string_lg_commentary_token_team_winningn _TWN_
|
||||
string_lg_commentary_token_team_losingn _TLN_
|
||||
string_lg_commentary_token_team _TT_
|
||||
string_lg_commentary_token_team_layer0 _TLAYER0_
|
||||
string_lg_commentary_token_team_layer1 _TLAYER1_
|
||||
string_lg_commentary_token_team_avskill0 _TAVSKILL0_
|
||||
string_lg_commentary_token_team_avskill1 _TAVSKILL1_
|
||||
string_lg_commentary_token_team_avskilldiff _TAVSKILLDIFF_
|
||||
|
||||
# player
|
||||
string_lg_commentary_token_player0 _P0_
|
||||
string_lg_commentary_token_player1 _P1_
|
||||
string_lg_commentary_token_player_goals0 _PLGOALS0_
|
||||
string_lg_commentary_token_player_goals_all0 _PLGOALSALL0_
|
||||
string_lg_commentary_token_player_goals1 _PLGOALS1_
|
||||
string_lg_commentary_token_player_goals_all1 _PLGOALSALL1_
|
||||
string_lg_commentary_token_player_yellows _PLYELLOWS_
|
||||
|
||||
# stat tokens
|
||||
string_lg_commentary_token_stat_shots0 _SHOTS0_
|
||||
string_lg_commentary_token_stat_shots1 _SHOTS1_
|
||||
string_lg_commentary_token_stat_shot_per0 _SHOTPER0_
|
||||
string_lg_commentary_token_stat_shot_per1 _SHOTPER1_
|
||||
string_lg_commentary_token_stat_poss0 _POSS0_
|
||||
string_lg_commentary_token_stat_poss1 _POSS1_
|
||||
string_lg_commentary_token_stat_pen0 _PEN0_
|
||||
string_lg_commentary_token_stat_pen1 _PEN1_
|
||||
string_lg_commentary_token_stat_fouls0 _FOULS0_
|
||||
string_lg_commentary_token_stat_fouls1 _FOULS1_
|
||||
string_lg_commentary_token_stat_yellows0 _YELLOWS0_
|
||||
string_lg_commentary_token_stat_yellows1 _YELLOWS1_
|
||||
string_lg_commentary_token_stat_reds0 _REDS0_
|
||||
string_lg_commentary_token_stat_reds1 _REDS1_
|
||||
string_lg_commentary_token_stat_injs0 _INJS0_
|
||||
string_lg_commentary_token_stat_injs1 _INJS1_
|
81
support_files/bygfoot_tokens
Normal file
81
support_files/bygfoot_tokens
Normal file
@ -0,0 +1,81 @@
|
||||
#################
|
||||
# tokens for the live game commentary
|
||||
##################
|
||||
|
||||
# see
|
||||
# http://bygfoot.sourceforge.net/doc/1.9/def_howto.html
|
||||
|
||||
# tokens in the live game commentary
|
||||
#------------------------------------
|
||||
|
||||
# general
|
||||
string_token_league_cup_name _LEAGUECUPNAME_
|
||||
string_token_cup_round_name _CUPROUNDNAME_
|
||||
string_token_attendance _AT_
|
||||
string_token_result _RE_
|
||||
string_token_time _TIME_
|
||||
string_token_minute _MI_
|
||||
string_token_minute_remaining _MR_
|
||||
string_token_minute_total _MT_
|
||||
string_token_yellow_limit _YELLOWLIMIT_
|
||||
string_token_goals0 _GOALS0_
|
||||
string_token_goals1 _GOALS1_
|
||||
string_token_goal_diff _GD_
|
||||
string_token_possession _POSS_
|
||||
string_token_no_possession _NPOSS_
|
||||
# misc
|
||||
string_token_extra _EX_
|
||||
# team
|
||||
string_token_team_home _T0_
|
||||
string_token_team_away _T1_
|
||||
string_token_team_losing _TL_
|
||||
string_token_team_winning _TW_
|
||||
string_token_team_winningn _TWN_
|
||||
string_token_team_losingn _TLN_
|
||||
string_token_team _TT_
|
||||
string_token_team_layer0 _TLAYER0_
|
||||
string_token_team_layer1 _TLAYER1_
|
||||
string_token_team_layerdiff _LAYERDIFF_
|
||||
string_token_team_avskill0 _TAVSKILL0_
|
||||
string_token_team_avskill1 _TAVSKILL1_
|
||||
string_token_team_avskilldiff _TAVSKILLDIFF_
|
||||
# player
|
||||
string_token_player0 _P0_
|
||||
string_token_player1 _P1_
|
||||
string_token_player_goals0 _PLGOALS0_
|
||||
string_token_player_goals_all0 _PLGOALSALL0_
|
||||
string_token_player_goals1 _PLGOALS1_
|
||||
string_token_player_goals_all1 _PLGOALSALL1_
|
||||
string_token_player_yellows _PLYELLOWS_
|
||||
# stat tokens
|
||||
string_token_stat_shots0 _SHOTS0_
|
||||
string_token_stat_shots1 _SHOTS1_
|
||||
string_token_stat_shot_per0 _SHOTPER0_
|
||||
string_token_stat_shot_per1 _SHOTPER1_
|
||||
string_token_stat_poss0 _POSS0_
|
||||
string_token_stat_poss1 _POSS1_
|
||||
string_token_stat_pen0 _PEN0_
|
||||
string_token_stat_pen1 _PEN1_
|
||||
string_token_stat_fouls0 _FOULS0_
|
||||
string_token_stat_fouls1 _FOULS1_
|
||||
string_token_stat_yellows0 _YELLOWS0_
|
||||
string_token_stat_yellows1 _YELLOWS1_
|
||||
string_token_stat_reds0 _REDS0_
|
||||
string_token_stat_reds1 _REDS1_
|
||||
string_token_stat_injs0 _INJS0_
|
||||
string_token_stat_injs1 _INJS1_
|
||||
|
||||
# tokens for CPU strategy
|
||||
#--------------------------
|
||||
|
||||
# prematch
|
||||
string_token_avskilldiff _AVSKILLDIFF_
|
||||
string_token_homeadv _HOMEADV_
|
||||
string_token_cup _CUP_
|
||||
string_token_goals_to_win _GOALSTOWIN_
|
||||
# match
|
||||
string_token_subs_left _SUBSLEFT_
|
||||
string_token_num_def _NUMDEF_
|
||||
string_token_num_mid _NUMMID_
|
||||
string_token_num_att _NUMATT_
|
||||
string_token_form _FORMATION_
|
@ -43,7 +43,7 @@
|
||||
<team_name>Dortmund</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Hamburger</team_name>
|
||||
<team_name>Hamburg</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Wolfsburg</team_name>
|
||||
|
@ -39,7 +39,7 @@
|
||||
<team_name>Freiburg</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>München</team_name>
|
||||
<team_name>T. München</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Fürth</team_name>
|
||||
|
@ -49,7 +49,7 @@
|
||||
<team_name>Düsseldorf</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Kiel </team_name>
|
||||
<team_name>Kiel</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Münster</team_name>
|
||||
|
@ -43,7 +43,7 @@
|
||||
<team_name>Regensburg</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Stuttgarter K.</team_name>
|
||||
<team_name>Stuttgart K.</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Elversberg</team_name>
|
||||
@ -67,7 +67,7 @@
|
||||
<team_name>Bayreuth</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Karlsruher SC</team_name>
|
||||
<team_name>Karlsruhe (A)</team_name>
|
||||
</team>
|
||||
<team>
|
||||
<team_name>Kaiserslautern (A)</team_name>
|
||||
|
BIN
support_files/pixmaps/menu_save_geometry.png
Normal file
BIN
support_files/pixmaps/menu_save_geometry.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 367 B |
Loading…
x
Reference in New Issue
Block a user