mirror of https://github.com/tstellar/bygfoot.git
"Job exchange, first buggy draft with lots of debugging output."
This commit is contained in:
parent
8a3ffc7c4a
commit
15ad0cbb01
140
bygfoot.glade
140
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="image2192">
|
||||
<widget class="GtkImage" id="image2274">
|
||||
<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="image2193">
|
||||
<widget class="GtkImage" id="image2275">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -200,7 +200,7 @@
|
|||
<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="image2194">
|
||||
<widget class="GtkImage" id="image2276">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_save_geometry.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -234,7 +234,7 @@
|
|||
<accelerator key="F3" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2195">
|
||||
<widget class="GtkImage" id="image2277">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_fixtures.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -255,7 +255,7 @@
|
|||
<accelerator key="F4" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2196">
|
||||
<widget class="GtkImage" id="image2278">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_fixtures_comp.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -276,7 +276,7 @@
|
|||
<accelerator key="F5" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2197">
|
||||
<widget class="GtkImage" id="image2279">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_table.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -297,7 +297,7 @@
|
|||
<accelerator key="F6" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2198">
|
||||
<widget class="GtkImage" id="image2280">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_league_results.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -318,7 +318,7 @@
|
|||
<accelerator key="s" modifiers="GDK_SHIFT_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2199">
|
||||
<widget class="GtkImage" id="image2281">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_season_res.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -345,7 +345,7 @@
|
|||
<accelerator key="s" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2200">
|
||||
<widget class="GtkImage" id="image2282">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_league_stats.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -366,7 +366,7 @@
|
|||
<accelerator key="h" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2201">
|
||||
<widget class="GtkImage" id="image2283">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_history.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -398,7 +398,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2202">
|
||||
<widget class="GtkImage" id="image2284">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_style.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -416,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">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -426,7 +426,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Defend</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:17:07 GMT"/>
|
||||
</widget>
|
||||
|
@ -437,7 +437,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Balanced</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:17:14 GMT"/>
|
||||
</widget>
|
||||
|
@ -448,7 +448,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Attack</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_release_event" handler="on_menu_team_button_release_event" last_modification_time="Mon, 28 Feb 2005 08:17:20 GMT"/>
|
||||
</widget>
|
||||
|
@ -476,7 +476,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2203">
|
||||
<widget class="GtkImage" id="image2285">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_scout.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -494,7 +494,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Best</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -504,7 +504,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Good</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -515,7 +515,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Average</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -543,7 +543,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2204">
|
||||
<widget class="GtkImage" id="image2286">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_physio.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -561,7 +561,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Best</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -571,7 +571,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Good</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -582,7 +582,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Average</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -610,7 +610,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2205">
|
||||
<widget class="GtkImage" id="image2287">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_youth_academy.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -647,7 +647,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Best</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -657,7 +657,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Good</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -668,7 +668,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Average</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -703,7 +703,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Goalies</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -713,7 +713,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Defenders</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -724,7 +724,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Midfielders</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -735,7 +735,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Forwards</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -777,7 +777,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2206">
|
||||
<widget class="GtkImage" id="image2288">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_boost.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -795,7 +795,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">On</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -805,7 +805,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Off</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="active">False</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>
|
||||
|
@ -840,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="image2207">
|
||||
<widget class="GtkImage" id="image2289">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-undo</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -861,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="image2208">
|
||||
<widget class="GtkImage" id="image2290">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_structure.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -883,7 +883,7 @@
|
|||
<accelerator key="r" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2209">
|
||||
<widget class="GtkImage" id="image2291">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_rearrange.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -909,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="image2210">
|
||||
<widget class="GtkImage" id="image2292">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_browse_tms.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -920,6 +920,23 @@
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="trennlinie16">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menu_show_job_exchange">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Show the list of available manager jobs</property>
|
||||
<property name="label" translatable="yes">Show job exchange</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_menu_show_job_exchange_activate" last_modification_time="Tue, 29 Nov 2005 13:48:22 GMT"/>
|
||||
<accelerator key="j" modifiers="0" signal="activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
@ -942,7 +959,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="image2211">
|
||||
<widget class="GtkImage" id="image2293">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_info.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -962,7 +979,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="image2212">
|
||||
<widget class="GtkImage" id="image2294">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_put_transfer.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -982,7 +999,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="image2213">
|
||||
<widget class="GtkImage" id="image2295">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_remove_transfer.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1002,7 +1019,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="image2214">
|
||||
<widget class="GtkImage" id="image2296">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_contract.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1022,7 +1039,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="image2215">
|
||||
<widget class="GtkImage" id="image2297">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_fire.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1042,7 +1059,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="image2216">
|
||||
<widget class="GtkImage" id="image2298">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_shoots.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1062,7 +1079,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="image2217">
|
||||
<widget class="GtkImage" id="image2299">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_move_to_ya.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1088,7 +1105,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="image2218">
|
||||
<widget class="GtkImage" id="image2300">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_player_browse.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1122,7 +1139,7 @@
|
|||
<accelerator key="v" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2219">
|
||||
<widget class="GtkImage" id="image2301">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_last_match.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1143,7 +1160,7 @@
|
|||
<accelerator key="F2" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2220">
|
||||
<widget class="GtkImage" id="image2302">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_match_stats.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1164,7 +1181,7 @@
|
|||
<accelerator key="F1" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2221">
|
||||
<widget class="GtkImage" id="image2303">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-jump-to</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1184,7 +1201,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2222">
|
||||
<widget class="GtkImage" id="image2304">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_mmatches.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1207,7 +1224,7 @@
|
|||
<accelerator key="a" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2223">
|
||||
<widget class="GtkImage" id="image2305">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1230,7 +1247,7 @@
|
|||
<accelerator key="m" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2224">
|
||||
<widget class="GtkImage" id="image2306">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1262,7 +1279,7 @@
|
|||
<accelerator key="h" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2225">
|
||||
<widget class="GtkImage" id="image2307">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_history.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1289,7 +1306,7 @@
|
|||
<accelerator key="F9" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2226">
|
||||
<widget class="GtkImage" id="image2308">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-media-forward</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1311,7 +1328,7 @@
|
|||
<accelerator key="F8" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2227">
|
||||
<widget class="GtkImage" id="image2309">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-go-back</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1333,7 +1350,7 @@
|
|||
<accelerator key="F12" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2228">
|
||||
<widget class="GtkImage" id="image2310">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-justify-fill</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1368,7 +1385,7 @@
|
|||
<accelerator key="f" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2229">
|
||||
<widget class="GtkImage" id="image2311">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_finances.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1389,7 +1406,7 @@
|
|||
<accelerator key="f" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image2230">
|
||||
<widget class="GtkImage" id="image2312">
|
||||
<property name="visible">True</property>
|
||||
<property name="pixbuf">menu_stadium.png</property>
|
||||
<property name="xalign">0.5</property>
|
||||
|
@ -1439,7 +1456,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="image2231">
|
||||
<widget class="GtkImage" id="image2313">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-info</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1460,7 +1477,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="image2232">
|
||||
<widget class="GtkImage" id="image2314">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1481,7 +1498,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="image2233">
|
||||
<widget class="GtkImage" id="image2315">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-help</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -2266,6 +2283,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="position">470</property>
|
||||
<signal name="button_release_event" handler="on_hpaned2_button_release_event" last_modification_time="Wed, 30 Nov 2005 09:43:15 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox3">
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<property name="title" translatable="yes">Job offer</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="default_width">500</property>
|
||||
<property name="default_height">600</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -9,7 +9,6 @@ INCLUDES = \
|
|||
bin_PROGRAMS = bygfoot
|
||||
|
||||
bygfoot_SOURCES = \
|
||||
mediaplayer.c mediaplayer.h \
|
||||
bet.c bet.h bet_struct.h \
|
||||
callback_func.c callback_func.h callbacks.h cup.h finance.h fixture.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h player.h start_end.h team.h transfer.h treeview.h treeview_helper.h user.h window.h \
|
||||
callbacks.c callback_func.h callbacks.h debug.h free.h game_gui.h game.h gui.h league.h load_save.h main.h option.h player.h table.h team.h transfer.h treeview2.h treeview.h treeview_helper.h user.h window.h \
|
||||
|
@ -23,6 +22,7 @@ bygfoot_SOURCES = \
|
|||
game_gui.c callbacks.h file.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h support.h team.h treeview.h user.h variables.h window.h \
|
||||
gui.c gui.h misc.h support.h variables.h window.h \
|
||||
interface.c callbacks.h interface.h support.h \
|
||||
job.c job.h \
|
||||
language.c callbacks.h free.h language.h lg_commentary.h misc.h option.h variables.h window.h \
|
||||
lg_commentary.c cup.h file.h fixture.h free.h league.h lg_commentary.h live_game.h main.h maths.h misc.h option.h player.h team.h variables.h xml_lg_commentary.h \
|
||||
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 \
|
||||
|
@ -60,6 +60,7 @@ bygfoot_SOURCES = \
|
|||
xml.c cup.h file.h free.h gui.h league.h misc.h option.h support.h table.h transfer_struct.h user.h variables.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_league.h xml_loadsave_league_stat.h xml_loadsave_live_game.h xml_loadsave_table.h xml_loadsave_teams.h xml_loadsave_transfers.h xml_loadsave_users.h \
|
||||
xml_loadsave_cup.c cup.h file.h misc.h table.h team.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_table.h xml_loadsave_teams.h \
|
||||
xml_loadsave_fixtures.c file.h fixture.h misc.h team.h xml.h xml_loadsave_fixtures.h \
|
||||
xml_loadsave_jobs.c xml_loadsave_jobs.h \
|
||||
xml_loadsave_league.c file.h league.h misc.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_league.h xml_loadsave_league_stat.h xml_loadsave_table.h xml_loadsave_teams.h \
|
||||
xml_loadsave_leagues_cups.c cup.h file.h free.h league_struct.h misc.h xml.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_leagues_cups.h \
|
||||
xml_loadsave_league_stat.c file.h misc.h stat.h team.h xml.h xml_loadsave_league_stat.h \
|
||||
|
|
|
@ -127,6 +127,11 @@ typedef struct
|
|||
*symbol, /**< Symbol of the country, eg a flag pixmap. */
|
||||
*sid; /**< Id of the country, eg 'england'. */
|
||||
|
||||
/** A rating point from 0-10 telling us
|
||||
how good the first league of the country is.
|
||||
Spain, for instance, has rating 10, whereas Ireland has only 5. */
|
||||
gint rating;
|
||||
|
||||
/** Leagues and cups arrays. */
|
||||
GArray *leagues, *cups;
|
||||
|
||||
|
@ -160,5 +165,8 @@ typedef struct
|
|||
*sponsors,
|
||||
*mmatches,
|
||||
*bets;
|
||||
|
||||
/** The position of the horizontal divider is stored here. */
|
||||
gint paned_pos;
|
||||
} Windows;
|
||||
#endif
|
||||
|
|
|
@ -101,14 +101,6 @@ callback_player_clicked(gint idx, GdkEventButton *event)
|
|||
if(event->type != GDK_BUTTON_PRESS)
|
||||
return;
|
||||
|
||||
/*d*/
|
||||
gint i;
|
||||
for(i=0;i<lig(1).teams->len;i++)
|
||||
printf("%d %s %d\n", i, g_array_index(lig(1).teams,
|
||||
Team, i).name,
|
||||
g_array_index(lig(1).teams,
|
||||
Team, i).id);
|
||||
|
||||
if(event->button == 1)
|
||||
{
|
||||
if(selected_row == -1)
|
||||
|
@ -704,6 +696,9 @@ callback_show_league_stats(gint type)
|
|||
void
|
||||
callback_show_season_history(gint type)
|
||||
{
|
||||
const SeasonStat *stat = NULL;
|
||||
gint len = season_stats->len;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
default:
|
||||
|
@ -712,29 +707,31 @@ callback_show_season_history(gint type)
|
|||
break;
|
||||
case SHOW_CURRENT:
|
||||
stat1 = -1;
|
||||
stat2 = season - 2;
|
||||
stat2 = len - 1;
|
||||
break;
|
||||
case SHOW_NEXT_LEAGUE:
|
||||
stat = &g_array_index(season_stats, SeasonStat, stat2);
|
||||
if(stat1 == -1)
|
||||
stat1 = 0;
|
||||
else if(stat1 == ligs->len - 1)
|
||||
else if(stat1 == stat->league_champs->len - 1)
|
||||
stat1 = -1;
|
||||
else
|
||||
stat1++;
|
||||
break;
|
||||
case SHOW_PREVIOUS_LEAGUE:
|
||||
stat = &g_array_index(season_stats, SeasonStat, stat2);
|
||||
if(stat1 == -1)
|
||||
stat1 = ligs->len - 1;
|
||||
stat1 = stat->league_champs->len - 1;
|
||||
else if(stat1 == 0)
|
||||
stat1 = -1;
|
||||
else
|
||||
stat1--;
|
||||
break;
|
||||
case SHOW_NEXT:
|
||||
stat2 = (stat2 + 1) % (season - 1);
|
||||
stat2 = (stat2 + 1) % len;
|
||||
break;
|
||||
case SHOW_PREVIOUS:
|
||||
stat2 = (stat2 == 0) ? season - 2 : stat2 - 1;
|
||||
stat2 = (stat2 == 0) ? len - 1 : stat2 - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "game.h"
|
||||
#include "game_gui.h"
|
||||
#include "gui.h"
|
||||
#include "job.h"
|
||||
#include "league.h"
|
||||
#include "load_save.h"
|
||||
#include "main.h"
|
||||
|
@ -419,9 +420,10 @@ void
|
|||
on_menu_season_history_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
if(season == 1)
|
||||
if(season_stats->len == 0)
|
||||
{
|
||||
game_gui_print_message(_("This is your first season."));
|
||||
game_gui_print_message(
|
||||
_("There are no season history elements stored yet."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -641,6 +643,12 @@ on_treeview_right_button_press_event (GtkWidget *widget,
|
|||
else
|
||||
window_show_menu_youth((GdkEvent*)event);
|
||||
break;
|
||||
case STATUS_SHOW_JOB_EXCHANGE:
|
||||
if(event->button == 1)
|
||||
game_gui_show_job_offer(NULL,
|
||||
&g_array_index(jobs, Job, idx - 1),
|
||||
STATUS_JOB_EXCHANGE_SHOW_TEAM);
|
||||
break;
|
||||
}
|
||||
|
||||
gui_set_arrows();
|
||||
|
@ -1185,3 +1193,30 @@ on_menu_betting_activate (GtkMenuItem *menuitem,
|
|||
window_show_bets();
|
||||
}
|
||||
|
||||
void
|
||||
on_menu_show_job_exchange_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
stat0 = STATUS_SHOW_JOB_EXCHANGE;
|
||||
|
||||
gui_set_arrows();
|
||||
|
||||
treeview2_show_job_exchange();
|
||||
|
||||
game_gui_print_message(
|
||||
_("Right click to apply for job at once, left click to see team info."));
|
||||
game_gui_print_message_with_delay(
|
||||
_("The job exchange update interval is %d weeks."),
|
||||
const_int("int_job_update_interval"));
|
||||
}
|
||||
|
||||
gboolean
|
||||
on_hpaned2_button_release_event (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
window.paned_pos =
|
||||
gtk_paned_get_position(GTK_PANED(widget));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -333,8 +333,14 @@ on_menu_save_window_geometry_activate (GtkMenuItem *menuitem,
|
|||
void
|
||||
on_menu_season_results_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
#endif
|
||||
|
||||
void
|
||||
on_menu_betting_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
void
|
||||
on_menu_show_job_exchange_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
gboolean
|
||||
on_hpaned2_button_release_event (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer user_data);
|
||||
#endif
|
||||
|
|
|
@ -257,7 +257,7 @@ cup_get_team_pointers(Cup *cup, gint round)
|
|||
|
||||
for(i=0;i<cup_round->teams->len;i++)
|
||||
{
|
||||
team_generate_players_stadium(&g_array_index(cup_round->teams, Team, i));
|
||||
team_generate_players_stadium(&g_array_index(cup_round->teams, Team, i), 0);
|
||||
g_ptr_array_add(cup->teams, &g_array_index(cup_round->teams, Team, i));
|
||||
g_ptr_array_add(teams, &g_array_index(cup_round->teams, Team, i));
|
||||
}
|
||||
|
@ -992,9 +992,10 @@ query_cup_begins(const Cup *cup)
|
|||
g_array_index(league->fixtures, Fixture,
|
||||
league->fixtures->len - 1).attendance == -1)) ||
|
||||
(league == NULL &&
|
||||
cup_temp->fixtures->len > 0 &&
|
||||
g_array_index(cup_temp->fixtures, Fixture,
|
||||
cup_temp->fixtures->len - 1).attendance == -1))
|
||||
((cup_temp->fixtures->len > 0 &&
|
||||
g_array_index(cup_temp->fixtures, Fixture,
|
||||
cup_temp->fixtures->len - 1).attendance == -1) ||
|
||||
cup_temp->fixtures->len == 0)))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,6 +137,8 @@ enum Status0Value
|
|||
STATUS_SELECT_MM_FILE_IMPORT,
|
||||
STATUS_SELECT_MM_FILE_EXPORT,
|
||||
STATUS_PLACE_BET,
|
||||
STATUS_SHOW_JOB_EXCHANGE,
|
||||
STATUS_JOB_EXCHANGE_SHOW_TEAM,
|
||||
STATUS_END
|
||||
};
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "callbacks.h"
|
||||
#include "finance.h"
|
||||
#include "game_gui.h"
|
||||
#include "league.h"
|
||||
#include "maths.h"
|
||||
#include "option.h"
|
||||
#include "player.h"
|
||||
|
@ -147,8 +148,6 @@ finance_update_user_weekly(User *user)
|
|||
{
|
||||
new_team = team_get_new(tm, TRUE);
|
||||
user_event_add(user, EVENT_TYPE_FIRE_FINANCE, -1, -1, new_team, NULL);
|
||||
user_history_add(user, USER_HISTORY_FIRE_FINANCES, tm->id,
|
||||
new_team->id, new_team->clid, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,17 +67,23 @@ fixture_write_cup_fixtures(Cup *cup)
|
|||
{
|
||||
gint i;
|
||||
|
||||
printf("fwc 1\n");
|
||||
|
||||
for(i=0;i<cup->rounds->len;i++)
|
||||
cup_get_team_pointers(cup, i);
|
||||
|
||||
printf("fwc 2 %d\n",
|
||||
g_array_index(cup->rounds, CupRound, 0).round_robin_number_of_groups);
|
||||
if(g_array_index(cup->rounds, CupRound, 0).round_robin_number_of_groups > 0)
|
||||
fixture_write_cup_round_robin(cup, 0,
|
||||
misc_copy_ptr_array(
|
||||
g_array_index(cup->rounds, CupRound, 0).team_ptrs));
|
||||
fixture_write_cup_round_robin(
|
||||
cup, 0, misc_copy_ptr_array(
|
||||
g_array_index(cup->rounds, CupRound, 0).team_ptrs));
|
||||
else
|
||||
fixture_write_knockout_round(cup, 0,
|
||||
misc_copy_ptr_array(
|
||||
g_array_index(cup->rounds, CupRound, 0).team_ptrs));
|
||||
fixture_write_knockout_round(
|
||||
cup, 0, misc_copy_ptr_array(
|
||||
g_array_index(cup->rounds, CupRound, 0).team_ptrs));
|
||||
printf("fwc 3\n");
|
||||
|
||||
}
|
||||
|
||||
/** Update the fixtures for the given cup.
|
||||
|
@ -1346,8 +1352,9 @@ fixture_get_goals_to_win(const Fixture *fix, const Team *tm)
|
|||
return return_value;
|
||||
}
|
||||
|
||||
gint
|
||||
fixture_get_goals_to_draw(const Fixture *fix, const Team *tm)
|
||||
{
|
||||
/*todo*/
|
||||
/* gint */
|
||||
/* fixture_get_goals_to_draw(const Fixture *fix, const Team *tm) */
|
||||
/* { */
|
||||
|
||||
}
|
||||
/* } */
|
||||
|
|
107
src/free.c
107
src/free.c
|
@ -42,12 +42,13 @@ free_memory(void)
|
|||
free_names(FALSE);
|
||||
free_transfer_list();
|
||||
free_strategies();
|
||||
free_country(FALSE);
|
||||
free_country(&country, FALSE);
|
||||
free_users(FALSE);
|
||||
free_bets(FALSE);
|
||||
free_live_game(&live_game_temp);
|
||||
free_lg_commentary(FALSE);
|
||||
free_support_dirs();
|
||||
free_jobs(FALSE);
|
||||
}
|
||||
|
||||
/** Free the transfer list. */
|
||||
|
@ -86,20 +87,24 @@ free_season_stats(gboolean reset)
|
|||
{
|
||||
free_gchar_ptr(
|
||||
g_array_index(
|
||||
g_array_index(season_stats, SeasonStat, i).league_champs, ChampStat, j).cl_name);
|
||||
g_array_index(season_stats, SeasonStat, i).league_champs,
|
||||
ChampStat, j).cl_name);
|
||||
free_gchar_ptr(
|
||||
g_array_index(
|
||||
g_array_index(season_stats, SeasonStat, i).league_champs, ChampStat, j).team_name);
|
||||
g_array_index(season_stats, SeasonStat, i).league_champs,
|
||||
ChampStat, j).team_name);
|
||||
}
|
||||
|
||||
for(j=0;j<g_array_index(season_stats, SeasonStat, i).cup_champs->len;j++)
|
||||
{
|
||||
free_gchar_ptr(
|
||||
g_array_index(
|
||||
g_array_index(season_stats, SeasonStat, i).cup_champs, ChampStat, j).cl_name);
|
||||
g_array_index(season_stats, SeasonStat, i).cup_champs,
|
||||
ChampStat, j).cl_name);
|
||||
free_gchar_ptr(
|
||||
g_array_index(
|
||||
g_array_index(season_stats, SeasonStat, i).cup_champs, ChampStat, j).team_name);
|
||||
g_array_index(season_stats, SeasonStat, i).cup_champs,
|
||||
ChampStat, j).team_name);
|
||||
}
|
||||
|
||||
g_array_free(g_array_index(season_stats, SeasonStat, i).cup_champs, TRUE);
|
||||
|
@ -139,7 +144,7 @@ free_users(gboolean reset)
|
|||
void
|
||||
free_user(User *user)
|
||||
{
|
||||
gint i;
|
||||
gint i, j;
|
||||
|
||||
free_gchar_ptr(user->name);
|
||||
free_g_string(&user->sponsor.name);
|
||||
|
@ -152,8 +157,14 @@ free_user(User *user)
|
|||
free_g_array(&user->events);
|
||||
|
||||
for(i=0;i<user->history->len;i++)
|
||||
{
|
||||
free_gchar_ptr(g_array_index(user->history,
|
||||
UserHistory, i).value_string);
|
||||
UserHistory, i).team_name);
|
||||
for(j=0;j<3;j++)
|
||||
free_gchar_ptr(g_array_index(user->history,
|
||||
UserHistory, i).string[j]);
|
||||
}
|
||||
|
||||
free_g_array(&user->history);
|
||||
|
||||
free_mmatches(&user->mmatches, FALSE);
|
||||
|
@ -261,23 +272,22 @@ free_live_game(LiveGame *match)
|
|||
free_g_array(&match->units);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Free the main variable of the game, #country.
|
||||
Free a country variable.
|
||||
*/
|
||||
void
|
||||
free_country(gboolean reset)
|
||||
free_country(Country *cntry, gboolean reset)
|
||||
{
|
||||
free_gchar_ptr(country.name);
|
||||
free_gchar_ptr(country.symbol);
|
||||
free_gchar_ptr(country.sid);
|
||||
free_gchar_ptr(cntry->name);
|
||||
free_gchar_ptr(cntry->symbol);
|
||||
free_gchar_ptr(cntry->sid);
|
||||
|
||||
free_leagues_array(&ligs, reset);
|
||||
free_cups_array(&cps, reset);
|
||||
free_g_ptr_array(&acps);
|
||||
free_leagues_array(&cntry->leagues, reset);
|
||||
free_cups_array(&cntry->cups, reset);
|
||||
free_g_ptr_array(&cntry->allcups);
|
||||
|
||||
if(reset)
|
||||
acps = g_ptr_array_new();
|
||||
cntry->allcups = g_ptr_array_new();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,12 +348,21 @@ free_league_stats(LeagueStat *stats)
|
|||
{
|
||||
gint i;
|
||||
|
||||
free_gchar_ptr(stats->league_name);
|
||||
free_gchar_ptr(stats->league_symbol);
|
||||
|
||||
for(i=0;i<stats->teams_off->len;i++)
|
||||
{
|
||||
free_gchar_ptr(g_array_index(stats->teams_off, Stat, i).team_name);
|
||||
free_gchar_ptr(g_array_index(stats->teams_off, Stat, i).value_string);
|
||||
}
|
||||
free_g_array(&stats->teams_off);
|
||||
|
||||
for(i=0;i<stats->teams_def->len;i++)
|
||||
{
|
||||
free_gchar_ptr(g_array_index(stats->teams_def, Stat, i).team_name);
|
||||
free_gchar_ptr(g_array_index(stats->teams_def, Stat, i).value_string);
|
||||
}
|
||||
free_g_array(&stats->teams_def);
|
||||
|
||||
for(i=0;i<stats->player_scorers->len;i++)
|
||||
|
@ -733,3 +752,57 @@ free_bets(gboolean reset)
|
|||
bets[1] = g_array_new(FALSE, FALSE, sizeof(BetMatch));
|
||||
}
|
||||
}
|
||||
|
||||
/** Free a job struct.
|
||||
@param free_team Whether to free the team associated
|
||||
with the job if it's an international offer. */
|
||||
void
|
||||
free_job(Job *job, gboolean free_tm)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if(job->type == JOB_TYPE_INTERNATIONAL)
|
||||
{
|
||||
free_gchar_ptr(job->country_file);
|
||||
free_gchar_ptr(job->country_name);
|
||||
free_gchar_ptr(job->league_name);
|
||||
|
||||
for(i=0;i<job_teams->len;i++)
|
||||
if(g_array_index(job_teams, Team, i).id == job->team_id)
|
||||
{
|
||||
if(free_tm)
|
||||
free_team(&g_array_index(job_teams, Team, i));
|
||||
g_array_remove_index(job_teams, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Free the jobs and job_teams arrays. */
|
||||
void
|
||||
free_jobs(gboolean reset)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if(jobs == NULL)
|
||||
{
|
||||
if(reset)
|
||||
{
|
||||
jobs = g_array_new(FALSE, FALSE, sizeof(Job));
|
||||
job_teams = g_array_new(FALSE, FALSE, sizeof(Team));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for(i=0;i<jobs->len;i++)
|
||||
free_job(&g_array_index(jobs, Job, i), TRUE);
|
||||
|
||||
free_g_array(&jobs);
|
||||
free_g_array(&job_teams);
|
||||
|
||||
if(reset)
|
||||
{
|
||||
jobs = g_array_new(FALSE, FALSE, sizeof(Job));
|
||||
job_teams = g_array_new(FALSE, FALSE, sizeof(Team));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "bygfoot.h"
|
||||
#include "cup_struct.h"
|
||||
#include "job_struct.h"
|
||||
#include "league_struct.h"
|
||||
#include "live_game_struct.h"
|
||||
#include "name_struct.h"
|
||||
|
@ -56,7 +57,7 @@ void
|
|||
free_user(User *user);
|
||||
|
||||
void
|
||||
free_country(gboolean reset);
|
||||
free_country(Country *cntry, gboolean reset);
|
||||
|
||||
void
|
||||
free_leagues_array(GArray **leagues, gboolean reset);
|
||||
|
@ -133,4 +134,10 @@ free_strategies(void);
|
|||
void
|
||||
free_bets(gboolean reset);
|
||||
|
||||
void
|
||||
free_job(Job *job, gboolean free_tm);
|
||||
|
||||
void
|
||||
free_jobs(gboolean reset);
|
||||
|
||||
#endif
|
||||
|
|
44
src/game.c
44
src/game.c
|
@ -1009,6 +1009,7 @@ game_post_match(Fixture *fix)
|
|||
gint i;
|
||||
GPtrArray *teams = NULL;
|
||||
Cup *cup = NULL;
|
||||
gchar buf[SMALL], buf2[SMALL];
|
||||
|
||||
if((debug > 100 && fixture_user_team_involved(fix) != -1) ||
|
||||
debug > 130)
|
||||
|
@ -1020,13 +1021,7 @@ 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 */
|
||||
team_update_post_match(fix->teams[i], fix);
|
||||
/* } */
|
||||
team_update_post_match(fix->teams[i], fix);
|
||||
|
||||
if(fix->clid < ID_CUP_START)
|
||||
return;
|
||||
|
@ -1039,19 +1034,40 @@ game_post_match(Fixture *fix)
|
|||
teams = cup_get_teams_sorted(cup);
|
||||
|
||||
if(team_is_user((Team*)g_ptr_array_index(teams, 0)) != -1)
|
||||
{
|
||||
user_history_add(&usr(team_is_user((Team*)g_ptr_array_index(teams, 0))),
|
||||
USER_HISTORY_WIN_FINAL, ((Team*)g_ptr_array_index(teams, 0))->id,
|
||||
fix->clid, fix->round,((Team*)g_ptr_array_index(teams, 1))->name);
|
||||
USER_HISTORY_WIN_FINAL,
|
||||
((Team*)g_ptr_array_index(teams, 0))->name,
|
||||
league_cup_get_name_string(fix->clid),
|
||||
((Team*)g_ptr_array_index(teams, 1))->name, NULL);
|
||||
user_add_cup_success(&usr(team_is_user((Team*)g_ptr_array_index(teams, 0))),
|
||||
cup, fix->round, USER_HISTORY_WIN_FINAL);
|
||||
}
|
||||
else if(team_is_user((Team*)g_ptr_array_index(teams, 1)) != -1)
|
||||
{
|
||||
user_history_add(&usr(team_is_user((Team*)g_ptr_array_index(teams, 1))),
|
||||
USER_HISTORY_LOSE_FINAL, ((Team*)g_ptr_array_index(teams, 1))->id,
|
||||
fix->clid, fix->round,((Team*)g_ptr_array_index(teams, 0))->name);
|
||||
USER_HISTORY_LOSE_FINAL,
|
||||
((Team*)g_ptr_array_index(teams, 1))->name,
|
||||
league_cup_get_name_string(fix->clid),
|
||||
((Team*)g_ptr_array_index(teams, 0))->name, NULL);
|
||||
user_add_cup_success(&usr(team_is_user((Team*)g_ptr_array_index(teams, 1))),
|
||||
cup, fix->round, USER_HISTORY_LOSE_FINAL);
|
||||
}
|
||||
g_ptr_array_free(teams, TRUE);
|
||||
}
|
||||
else if(fixture_user_team_involved(fix) != -1)
|
||||
user_history_add(&usr(fixture_user_team_involved(fix)), USER_HISTORY_REACH_CUP_ROUND,
|
||||
usr(fixture_user_team_involved(fix)).team_id,
|
||||
fix->clid, fix->round, "");
|
||||
{
|
||||
cup_get_round_name(cup_from_clid(fix->clid), fix->round, buf);
|
||||
sprintf(buf2, "%d", fix->round + 1);
|
||||
|
||||
user_history_add(&usr(fixture_user_team_involved(fix)),
|
||||
USER_HISTORY_REACH_CUP_ROUND,
|
||||
usr(fixture_user_team_involved(fix)).name,
|
||||
league_cup_get_name_string(fix->clid),
|
||||
buf, buf2);
|
||||
user_add_cup_success(&usr(fixture_user_team_involved(fix)),
|
||||
cup, fix->round, USER_HISTORY_REACH_CUP_ROUND);
|
||||
}
|
||||
}
|
||||
|
||||
/** Reduce stadium capacity and safety after a stadium event.
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "file.h"
|
||||
#include "game_gui.h"
|
||||
#include "gui.h"
|
||||
#include "job.h"
|
||||
#include "league.h"
|
||||
#include "live_game.h"
|
||||
#include "maths.h"
|
||||
|
@ -680,15 +681,31 @@ game_gui_show_warning(const gchar *format, ...)
|
|||
}
|
||||
|
||||
/** Show the job offer window.
|
||||
@param team The team offering the job.
|
||||
@param type The offer type (whether the user's been fired). */
|
||||
@param team The team offering the job or NULL if we're looking
|
||||
at a job offer from the job exchange.
|
||||
@param job The job pointer or NULL (depends on whether we're looking
|
||||
at a job offer from the job exchange).
|
||||
@param type The offer type (eg. whether the user's been fired). */
|
||||
void
|
||||
game_gui_show_job_offer(Team *team, gint type)
|
||||
game_gui_show_job_offer(Team *team, Job *job, gint type)
|
||||
{
|
||||
gchar buf[SMALL], buf2[SMALL];
|
||||
GtkLabel *label_text, *label_text2, *label_name,
|
||||
*label_league, *label_rank, *label_money,
|
||||
*label_cap, *label_saf, *label_average_skill;
|
||||
Team *tm = (type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ?
|
||||
team : job_get_team(job);
|
||||
|
||||
statp = (type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ?
|
||||
(gpointer)team : (gpointer)job;
|
||||
stat2 = type;
|
||||
|
||||
if(type == STATUS_JOB_OFFER_FIRE_FINANCE ||
|
||||
type == STATUS_JOB_OFFER_FIRE_FAILURE)
|
||||
user_history_add(¤t_user, (type == STATUS_JOB_OFFER_FIRE_FINANCE) ?
|
||||
USER_HISTORY_FIRE_FINANCE : USER_HISTORY_FIRE_FAILURE,
|
||||
current_user.tm->name, team->name,
|
||||
league_cup_get_name_string(team->clid), NULL);
|
||||
|
||||
window_create(WINDOW_JOB_OFFER);
|
||||
|
||||
|
@ -705,38 +722,55 @@ game_gui_show_job_offer(Team *team, gint type)
|
|||
|
||||
if(type == STATUS_JOB_OFFER_FIRE_FINANCE)
|
||||
sprintf(buf, _("The team owners have fired you because of financial mismanagement. Luckily, the owners of %s have heard of your dismissal and offer you a job. Here's some information on %s:"),
|
||||
team->name, team->name);
|
||||
tm->name, tm->name);
|
||||
else if(type == STATUS_JOB_OFFER_FIRE_FAILURE)
|
||||
sprintf(buf, _("The team owners have fired you because of unsuccessfulness. Luckily, the owners of %s have heard of your dismissal and offer you a job. Here's some information on %s:"),
|
||||
team->name, team->name);
|
||||
tm->name, tm->name);
|
||||
else if(type == STATUS_JOB_OFFER_SUCCESS)
|
||||
sprintf(buf, _("The owners of %s are deeply impressed by your success with %s and would like to hire you. Here's some information on %s:"),
|
||||
team->name, current_user.tm->name, team->name);
|
||||
tm->name, current_user.tm->name, tm->name);
|
||||
else if(type == STATUS_JOB_EXCHANGE_SHOW_TEAM)
|
||||
strcpy(buf, _("Click on OK to apply for the job. Click on CANCEL to close the window."));
|
||||
|
||||
strcpy(buf2, _("Accept?"));
|
||||
if(type != STATUS_JOB_OFFER_SUCCESS)
|
||||
strcpy(buf2, (type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ?
|
||||
_("Accept?") : _("Apply for the job?"));
|
||||
|
||||
if(type != STATUS_JOB_OFFER_SUCCESS &&
|
||||
type != STATUS_JOB_EXCHANGE_SHOW_TEAM)
|
||||
strcat(buf2, _(" (NOTE: If you don't, the game is over for you.)"));
|
||||
|
||||
gtk_label_set_text(label_text, buf);
|
||||
gtk_label_set_text(label_text2, buf2);
|
||||
gtk_label_set_text(label_name, team->name);
|
||||
gtk_label_set_text(label_league, league_cup_get_name_string(team->clid));
|
||||
gui_label_set_text_from_int(label_rank, team_get_league_rank(team), FALSE);
|
||||
misc_print_grouped_int(math_round_integer(team->stadium.capacity *
|
||||
math_rndi(const_int("int_initial_money_lower"),
|
||||
const_int("int_initial_money_upper")), 2),
|
||||
buf);
|
||||
gtk_label_set_text(label_money, buf);
|
||||
misc_print_grouped_int(team->stadium.capacity, buf);
|
||||
gtk_label_set_text(label_cap, buf);
|
||||
gui_label_set_text_from_int(label_saf, (gint)rint(team->stadium.safety * 100), FALSE);
|
||||
gtk_label_set_text(label_name, tm->name);
|
||||
gtk_label_set_text(label_league,
|
||||
(type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ?
|
||||
league_cup_get_name_string(tm->clid) : job->league_name);
|
||||
|
||||
sprintf(buf, "%.1f", team_get_average_skill(team, FALSE));
|
||||
if(job == NULL ||
|
||||
job->type == JOB_TYPE_NATIONAL)
|
||||
gui_label_set_text_from_int(label_rank,
|
||||
team_get_league_rank(tm), FALSE);
|
||||
|
||||
misc_print_grouped_int(
|
||||
math_round_integer(tm->stadium.capacity *
|
||||
math_rndi(const_int("int_initial_money_lower"),
|
||||
const_int("int_initial_money_upper")), 2),
|
||||
buf);
|
||||
|
||||
gtk_label_set_text(label_money, buf);
|
||||
misc_print_grouped_int(tm->stadium.capacity, buf);
|
||||
gtk_label_set_text(label_cap, buf);
|
||||
gui_label_set_text_from_int(label_saf,
|
||||
(gint)rint(tm->stadium.safety * 100), FALSE);
|
||||
|
||||
sprintf(buf, "%.1f", team_get_average_skill(tm, FALSE));
|
||||
gtk_label_set_text(label_average_skill, buf);
|
||||
|
||||
treeview_show_player_list_team(GTK_TREE_VIEW(lookup_widget(window.job_offer, "treeview_players")),
|
||||
team,
|
||||
(type != STATUS_JOB_OFFER_SUCCESS) ? 2 : current_user.scout);
|
||||
treeview_show_player_list_team(
|
||||
GTK_TREE_VIEW(lookup_widget(window.job_offer, "treeview_players")),
|
||||
tm,
|
||||
(type != STATUS_JOB_OFFER_SUCCESS && type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ?
|
||||
2 : current_user.scout);
|
||||
}
|
||||
|
||||
/** Write the checkbuttons in the menus. */
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <glib/gprintf.h>
|
||||
|
||||
#include "bygfoot.h"
|
||||
#include "job_struct.h"
|
||||
#include "live_game_struct.h"
|
||||
#include "option_struct.h"
|
||||
|
||||
|
@ -95,7 +96,7 @@ void
|
|||
game_gui_write_meters(const Team *tm);
|
||||
|
||||
void
|
||||
game_gui_show_job_offer(Team *team, gint type);
|
||||
game_gui_show_job_offer(Team *team, Job *job, gint type);
|
||||
|
||||
void
|
||||
game_gui_write_check_items(void);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "gui.h"
|
||||
#include "misc.h"
|
||||
#include "option.h"
|
||||
#include "support.h"
|
||||
#include "variables.h"
|
||||
#include "window.h"
|
||||
|
|
462
src/interface.c
462
src/interface.c
File diff suppressed because it is too large
Load Diff
12
src/league.c
12
src/league.c
|
@ -76,7 +76,7 @@ league_new(gboolean new_id)
|
|||
new.round_robins = 2;
|
||||
new.yellow_red = 1000;
|
||||
|
||||
new.stats = stat_league_new(new.id);
|
||||
new.stats = stat_league_new("", "");
|
||||
|
||||
new.active = TRUE;
|
||||
|
||||
|
@ -731,12 +731,14 @@ league_team_movements_assign_dest(GArray *team_movements, gint idx,
|
|||
{
|
||||
if(tmove->prom_rel_type == PROM_REL_PROMOTION)
|
||||
user_history_add(&usr(team_is_user(&tmove->tm)),
|
||||
USER_HISTORY_PROMOTED, tmove->tm.id,
|
||||
lig(g_array_index(tmove->dest_idcs, gint, 0)).id, -1, "");
|
||||
USER_HISTORY_PROMOTED, tmove->tm.name,
|
||||
lig(g_array_index(tmove->dest_idcs, gint, 0)).name,
|
||||
NULL, NULL);
|
||||
else
|
||||
user_history_add(&usr(team_is_user(&tmove->tm)),
|
||||
USER_HISTORY_RELEGATED, tmove->tm.id,
|
||||
lig(g_array_index(tmove->dest_idcs, gint, 0)).id, -1, "");
|
||||
USER_HISTORY_RELEGATED, tmove->tm.name,
|
||||
lig(g_array_index(tmove->dest_idcs, gint, 0)).name,
|
||||
NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,16 +35,17 @@
|
|||
#include "user.h"
|
||||
#include "variables.h"
|
||||
#include "window.h"
|
||||
#include "xml_loadsave_misc.h"
|
||||
#include "xml_loadsave_cup.h"
|
||||
#include "xml_loadsave_jobs.h"
|
||||
#include "xml_loadsave_league.h"
|
||||
#include "xml_loadsave_leagues_cups.h"
|
||||
#include "xml_loadsave_misc.h"
|
||||
#include "xml_loadsave_season_stats.h"
|
||||
#include "xml_loadsave_transfers.h"
|
||||
#include "xml_loadsave_users.h"
|
||||
#include "xml.h"
|
||||
|
||||
#define PROGRESS_MAX 7
|
||||
#define PROGRESS_MAX 8
|
||||
|
||||
/** Save the game to the specified file. */
|
||||
void
|
||||
|
@ -119,6 +120,18 @@ load_save_save_game(const gchar *filename)
|
|||
|
||||
xml_loadsave_season_stats_write(prefix);
|
||||
|
||||
if(debug > 60)
|
||||
printf("load_save_save jobs \n");
|
||||
|
||||
gui_show_progress(
|
||||
((PROGRESS_MAX * gtk_progress_bar_get_fraction(
|
||||
GTK_PROGRESS_BAR(
|
||||
lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX,
|
||||
_("Saving job exchange..."),
|
||||
PIC_TYPE_SAVE);
|
||||
|
||||
xml_loadsave_jobs_write(prefix);
|
||||
|
||||
if(debug > 60)
|
||||
printf("load_save_save misc \n");
|
||||
|
||||
|
@ -259,6 +272,18 @@ load_save_load_game(const gchar* filename, gboolean create_main_window)
|
|||
|
||||
xml_loadsave_season_stats_read(dirname, prefix);
|
||||
|
||||
if(debug > 60)
|
||||
printf("load_save_load jobs \n");
|
||||
|
||||
gui_show_progress(
|
||||
((PROGRESS_MAX * gtk_progress_bar_get_fraction(
|
||||
GTK_PROGRESS_BAR(
|
||||
lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX,
|
||||
_("Loading job exchange..."),
|
||||
PIC_TYPE_LOAD);
|
||||
|
||||
xml_loadsave_jobs_read(dirname, prefix);
|
||||
|
||||
if(debug > 60)
|
||||
printf("load_save_load misc \n");
|
||||
|
||||
|
|
|
@ -35,12 +35,13 @@
|
|||
#include "debug.h"
|
||||
#include "file.h"
|
||||
#include "free.h"
|
||||
#include "job_struct.h"
|
||||
#include "language.h"
|
||||
#include "lg_commentary.h"
|
||||
#include "live_game.h"
|
||||
#include "load_save.h"
|
||||
#include "main.h"
|
||||
#include "mediaplayer.h"
|
||||
/* #include "mediaplayer.h" */
|
||||
#include "misc.h"
|
||||
#include "misc_callbacks.h"
|
||||
#include "name_struct.h"
|
||||
|
@ -183,6 +184,8 @@ main_init_variables(void)
|
|||
strategies = g_array_new(FALSE, FALSE, sizeof(Strategy));
|
||||
bets[0] = g_array_new(FALSE, FALSE, sizeof(BetMatch));
|
||||
bets[1] = g_array_new(FALSE, FALSE, sizeof(BetMatch));
|
||||
jobs = g_array_new(FALSE, FALSE, sizeof(Job));
|
||||
job_teams = g_array_new(FALSE, FALSE, sizeof(Team));
|
||||
|
||||
save_file = NULL;
|
||||
|
||||
|
@ -279,7 +282,7 @@ main (gint argc, gchar *argv[])
|
|||
|
||||
gtk_set_locale ();
|
||||
gtk_init (&argc, &argv);
|
||||
mediaplayer_init(&argc, &argv);
|
||||
/* mediaplayer_init(&argc, &argv); */
|
||||
|
||||
main_init(&argc, &argv);
|
||||
|
||||
|
|
|
@ -458,6 +458,9 @@ misc_parse(const gchar *s, gint *result)
|
|||
void
|
||||
misc_string_assign(gchar **string, const gchar *contents)
|
||||
{
|
||||
if(contents == NULL)
|
||||
return;
|
||||
|
||||
if(*string != NULL)
|
||||
g_free(*string);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "finance.h"
|
||||
#include "free.h"
|
||||
#include "game_gui.h"
|
||||
#include "league.h"
|
||||
#include "maths.h"
|
||||
#include "misc.h"
|
||||
#include "misc2_callback_func.h"
|
||||
|
@ -231,7 +232,9 @@ misc2_callback_add_user(void)
|
|||
new_user.tm = tm;
|
||||
new_user.team_id = tm->id;
|
||||
|
||||
user_history_add(&new_user, USER_HISTORY_START_GAME, tm->id, tm->clid, -1, "");
|
||||
user_history_add(&new_user, USER_HISTORY_START_GAME,
|
||||
tm->name, league_cup_get_name_string(tm->clid),
|
||||
NULL, NULL);
|
||||
|
||||
g_array_append_val(users, new_user);
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "finance.h"
|
||||
#include "free.h"
|
||||
#include "game_gui.h"
|
||||
#include "league.h"
|
||||
#include "job.h"
|
||||
#include "load_save.h"
|
||||
#include "main.h"
|
||||
#include "misc2_callbacks.h"
|
||||
|
@ -37,6 +39,7 @@
|
|||
#include "misc2_interface.h"
|
||||
#include "player.h"
|
||||
#include "support.h"
|
||||
#include "team.h"
|
||||
#include "transfer.h"
|
||||
#include "treeview.h"
|
||||
#include "treeview2.h"
|
||||
|
@ -44,38 +47,72 @@
|
|||
#include "user.h"
|
||||
#include "window.h"
|
||||
|
||||
gboolean
|
||||
on_button_cancel_clicked (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_button_ok_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_button_offer_ok_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
if(stat2 == STATUS_JOB_OFFER_SUCCESS)
|
||||
user_history_add(¤t_user, USER_HISTORY_JOB_OFFER_ACCEPTED,
|
||||
current_user.tm->id, ((Team*)statp)->id, ((Team*)statp)->clid, "");
|
||||
gboolean changed = TRUE;
|
||||
gchar *team_name = g_strdup(current_user.tm->name);
|
||||
|
||||
user_change_team(¤t_user, (Team*)statp);
|
||||
if(stat2 == STATUS_JOB_EXCHANGE_SHOW_TEAM)
|
||||
{
|
||||
if(query_job_application_successful((Job*)statp, ¤t_user))
|
||||
{
|
||||
if(((Job*)statp)->type != JOB_TYPE_NATIONAL)
|
||||
{
|
||||
game_gui_show_warning(
|
||||
_("The owners of %s accept your application. Since %s don't want to get stuck with a lame duck, you get fired instantly and spend the rest of the current season tending your garden."),
|
||||
job_get_team((Job*)statp)->name, current_user.tm->name);
|
||||
job_change_country((Job*)statp);
|
||||
}
|
||||
else
|
||||
game_gui_show_warning(
|
||||
_("The owners of %s accept your application."),
|
||||
current_user.tm->name);
|
||||
|
||||
stat0 = STATUS_MAIN;
|
||||
game_gui_show_main();
|
||||
printf("misc2 1\n");
|
||||
user_change_team(¤t_user, team_of_id(((Job*)statp)->team_id));
|
||||
|
||||
window_destroy(&window.job_offer, TRUE);
|
||||
printf("misc2 2\n");
|
||||
if(((Job*)statp)->type == JOB_TYPE_NATIONAL)
|
||||
job_remove((Job*)statp, TRUE);
|
||||
else
|
||||
{
|
||||
job_remove((Job*)statp, FALSE);
|
||||
job_remove_national();
|
||||
}
|
||||
printf("misc2 3\n");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
game_gui_show_warning(
|
||||
_("The owners of %s politely reject your application. You're not successful enough in their eyes."),
|
||||
job_get_team((Job*)statp)->name);
|
||||
changed = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
user_change_team(¤t_user, (Team*)statp);
|
||||
|
||||
printf("misc2 4\n");
|
||||
if(changed)
|
||||
{
|
||||
if(stat2 == STATUS_JOB_OFFER_SUCCESS ||
|
||||
stat2 == STATUS_JOB_EXCHANGE_SHOW_TEAM)
|
||||
user_history_add(¤t_user, USER_HISTORY_JOB_OFFER_ACCEPTED,
|
||||
team_name,
|
||||
current_user.tm->name,
|
||||
league_cup_get_name_string(current_user.tm->clid),
|
||||
NULL);
|
||||
|
||||
stat0 = STATUS_MAIN;
|
||||
game_gui_show_main();
|
||||
}
|
||||
|
||||
g_free(team_name);
|
||||
|
||||
window_destroy(&window.job_offer, FALSE);
|
||||
|
||||
setsav0;
|
||||
}
|
||||
|
@ -85,7 +122,8 @@ void
|
|||
on_button_offer_cancel_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
if(stat2 != STATUS_JOB_OFFER_SUCCESS)
|
||||
if(stat2 != STATUS_JOB_OFFER_SUCCESS &&
|
||||
stat2 != STATUS_JOB_EXCHANGE_SHOW_TEAM)
|
||||
{
|
||||
if(users->len == 1)
|
||||
main_exit_program(EXIT_USER_FIRED, NULL);
|
||||
|
@ -96,9 +134,13 @@ on_button_offer_cancel_clicked (GtkButton *button,
|
|||
}
|
||||
}
|
||||
|
||||
window_destroy(&window.job_offer, TRUE);
|
||||
stat0 = STATUS_MAIN;
|
||||
game_gui_show_main();
|
||||
window_destroy(&window.job_offer, FALSE);
|
||||
|
||||
if(stat0 != STATUS_SHOW_JOB_EXCHANGE)
|
||||
{
|
||||
stat0 = STATUS_MAIN;
|
||||
game_gui_show_main();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,15 +29,6 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
gboolean
|
||||
on_button_cancel_clicked (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_button_ok_clicked (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_button_offer_ok_clicked (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
|
|
@ -70,7 +70,8 @@ create_window_job_offer (void)
|
|||
gtk_container_set_border_width (GTK_CONTAINER (window_job_offer), 6);
|
||||
gtk_window_set_title (GTK_WINDOW (window_job_offer), _("Job offer"));
|
||||
gtk_window_set_position (GTK_WINDOW (window_job_offer), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window_job_offer), -1, 600);
|
||||
gtk_window_set_modal (GTK_WINDOW (window_job_offer), TRUE);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window_job_offer), 500, 600);
|
||||
|
||||
vbox5 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox5);
|
||||
|
|
|
@ -54,7 +54,7 @@ misc_callback_show_team_list(GtkWidget *widget, const gchar *country_file)
|
|||
GtkWidget *treeview_startup =
|
||||
lookup_widget(widget, "treeview_startup");
|
||||
|
||||
xml_country_read(country_file);
|
||||
xml_country_read(country_file, NULL);
|
||||
|
||||
treeview_show_team_list(GTK_TREE_VIEW(treeview_startup), FALSE, FALSE);
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "free.h"
|
||||
#include "game_gui.h"
|
||||
#include "gui.h"
|
||||
#include "job.h"
|
||||
#include "league.h"
|
||||
#include "live_game.h"
|
||||
#include "load_save.h"
|
||||
|
@ -69,7 +70,7 @@ WeekFunc start_week_round_funcs[] =
|
|||
WeekFunc start_week_funcs[] =
|
||||
{start_week_add_cups, start_week_update_users,
|
||||
start_week_update_teams, start_week_update_user_finances,
|
||||
youth_academy_update_weekly, transfer_update, NULL};
|
||||
youth_academy_update_weekly, transfer_update, job_update, NULL};
|
||||
|
||||
WeekFunc end_week_funcs[] = {stat_update_leagues, end_week_hide_cups, NULL};
|
||||
|
||||
|
@ -88,6 +89,7 @@ void
|
|||
start_new_season(void)
|
||||
{
|
||||
gint i, j;
|
||||
gchar buf[SMALL];
|
||||
|
||||
week = week_round = 1;
|
||||
free_names(TRUE);
|
||||
|
@ -102,6 +104,7 @@ start_new_season(void)
|
|||
g_ptr_array_remove_index(acps, i);
|
||||
}
|
||||
|
||||
printf("s1\n");
|
||||
for(i=cps->len - 1; i >= 0; i--)
|
||||
if(cp(i).add_week == -1)
|
||||
{
|
||||
|
@ -109,12 +112,17 @@ start_new_season(void)
|
|||
fixture_write_cup_fixtures(&cp(i));
|
||||
}
|
||||
|
||||
printf("s2\n");
|
||||
if(season > 1)
|
||||
{
|
||||
for(i=0;i<users->len;i++)
|
||||
{
|
||||
sprintf(buf, "%d", team_get_league_rank(usr(i).tm));
|
||||
user_history_add(&usr(i), USER_HISTORY_END_SEASON,
|
||||
usr(i).team_id, usr(i).tm->clid,
|
||||
team_get_league_rank(usr(i).tm), "");
|
||||
usr(i).tm->name,
|
||||
league_cup_get_name_string(usr(i).tm->clid),
|
||||
buf, NULL);
|
||||
}
|
||||
|
||||
start_new_season_league_changes();
|
||||
|
||||
|
@ -136,17 +144,25 @@ start_new_season(void)
|
|||
g_ptr_array_add(acps, &cp(i));
|
||||
}
|
||||
|
||||
printf("s3\n");
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(lig(i).active)
|
||||
fixture_write_league_fixtures(&lig(i));
|
||||
|
||||
printf("s4\n");
|
||||
for(i=cps->len - 1; i >= 0; i--)
|
||||
{
|
||||
printf("%d %s adw %d\n", i, cp(i).name, cp(i).add_week);
|
||||
|
||||
if(cp(i).add_week >= 0)
|
||||
{
|
||||
printf("res\n");
|
||||
cup_reset(&cp(i));
|
||||
|
||||
printf("fix\n");
|
||||
if(cp(i).add_week == 0)
|
||||
fixture_write_cup_fixtures(&cp(i));
|
||||
printf("done\n");
|
||||
}
|
||||
else if(cp(i).add_week == -1)
|
||||
{
|
||||
|
@ -158,7 +174,11 @@ start_new_season(void)
|
|||
team_of_id(g_array_index(cp(i).fixtures, Fixture, j).team_ids[1]);
|
||||
}
|
||||
}
|
||||
|
||||
printf("#%d %s adw %d\n", i, cp(i).name, cp(i).add_week);
|
||||
}
|
||||
|
||||
printf("s5\n");
|
||||
stat5 = -1;
|
||||
|
||||
for(i=0;i<name_lists->len;i++)
|
||||
|
@ -166,6 +186,8 @@ start_new_season(void)
|
|||
|
||||
if(season == 1)
|
||||
bet_update();
|
||||
|
||||
printf("s6\n");
|
||||
}
|
||||
|
||||
/** Fill some global variables with default values at the
|
||||
|
@ -196,7 +218,7 @@ start_generate_league_teams(void)
|
|||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
for(j=0;j<lig(i).teams->len;j++)
|
||||
team_generate_players_stadium(&g_array_index(lig(i).teams, Team, j));
|
||||
team_generate_players_stadium(&g_array_index(lig(i).teams, Team, j), 0);
|
||||
|
||||
stat5 = -1;
|
||||
}
|
||||
|
@ -365,8 +387,11 @@ end_week_round_update_fixtures(void)
|
|||
week_round == 1 &&
|
||||
team_is_user(g_array_index(lig(i).table.elements, TableElement, 0).team) != -1)
|
||||
user_history_add(&usr(team_is_user(g_array_index(lig(i).table.elements, TableElement, 0).team)),
|
||||
USER_HISTORY_CHAMPION, g_array_index(lig(i).table.elements, TableElement, 0).team_id,
|
||||
lig(i).id, -1, "");
|
||||
USER_HISTORY_CHAMPION,
|
||||
g_array_index(lig(i).table.elements,
|
||||
TableElement, 0).team->name,
|
||||
league_cup_get_name_string(lig(i).id),
|
||||
NULL, NULL);
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
{
|
||||
|
@ -569,12 +594,6 @@ start_new_season_league_changes(void)
|
|||
for(i=0;i<ligs->len;i++)
|
||||
league_size[i] = lig(i).teams->len;
|
||||
|
||||
/*d*/
|
||||
for(i=0;i<lig(1).teams->len;i++)
|
||||
printf("# %d %s %d\n", i,
|
||||
g_array_index(lig(1).teams, Team, i).name,
|
||||
g_array_index(lig(1).teams, Team, i).id);
|
||||
|
||||
for(i=0;i<team_movements->len;i++)
|
||||
league_remove_team_with_id(
|
||||
league_from_clid(g_array_index(team_movements, TeamMove, i).tm.clid),
|
||||
|
@ -583,17 +602,21 @@ start_new_season_league_changes(void)
|
|||
league_team_movements_destinations(team_movements, league_size);
|
||||
|
||||
for(i = team_movements->len - 1; i >= 0; i--)
|
||||
if(g_array_index(team_movements, TeamMove, i).prom_rel_type == PROM_REL_RELEGATION)
|
||||
if(g_array_index(team_movements, TeamMove, i).prom_rel_type ==
|
||||
PROM_REL_RELEGATION)
|
||||
g_array_prepend_val(
|
||||
lig(g_array_index(
|
||||
g_array_index(team_movements, TeamMove, i).dest_idcs, gint, 0)).teams,
|
||||
g_array_index(team_movements, TeamMove, i).dest_idcs,
|
||||
gint, 0)).teams,
|
||||
g_array_index(team_movements, TeamMove, i).tm);
|
||||
|
||||
for(i=1;i<team_movements->len;i++)
|
||||
if(g_array_index(team_movements, TeamMove, i).prom_rel_type != PROM_REL_RELEGATION)
|
||||
if(g_array_index(team_movements, TeamMove, i).prom_rel_type !=
|
||||
PROM_REL_RELEGATION)
|
||||
g_array_append_val(
|
||||
lig(g_array_index(
|
||||
g_array_index(team_movements, TeamMove, i).dest_idcs, gint, 0)).teams,
|
||||
g_array_index(team_movements, TeamMove, i).dest_idcs,
|
||||
gint, 0)).teams,
|
||||
g_array_index(team_movements, TeamMove, i).tm);
|
||||
|
||||
for(i=0;i<team_movements->len;i++)
|
||||
|
@ -606,7 +629,8 @@ start_new_season_league_changes(void)
|
|||
{
|
||||
g_array_index(lig(i).teams, Team, j).clid = lig(i).id;
|
||||
for(k=0;k<g_array_index(lig(i).teams, Team, j).players->len;k++)
|
||||
g_array_index(g_array_index(lig(i).teams, Team, j).players, Player, k).team =
|
||||
g_array_index(g_array_index(lig(i).teams, Team, j).players,
|
||||
Player, k).team =
|
||||
&g_array_index(lig(i).teams, Team, j);
|
||||
}
|
||||
|
||||
|
|
30
src/stat.c
30
src/stat.c
|
@ -33,13 +33,15 @@
|
|||
#include "team.h"
|
||||
#include "variables.h"
|
||||
|
||||
/** Return a newly allocated league stat with given clid. */
|
||||
/** Return a newly allocated league stat with specified
|
||||
league name and symbol. */
|
||||
LeagueStat
|
||||
stat_league_new(gint clid)
|
||||
stat_league_new(const gchar *league_name, const gchar *league_symbol)
|
||||
{
|
||||
LeagueStat new;
|
||||
|
||||
new.clid = clid;
|
||||
|
||||
new.league_name = g_strdup(league_name);
|
||||
new.league_symbol = g_strdup(league_symbol);
|
||||
new.teams_off = g_array_new(FALSE, FALSE, sizeof(Stat));
|
||||
new.teams_def = g_array_new(FALSE, FALSE, sizeof(Stat));
|
||||
new.player_scorers = g_array_new(FALSE, FALSE, sizeof(Stat));
|
||||
|
@ -60,8 +62,12 @@ stat_update_leagues(void)
|
|||
lig(i).fixtures, Fixture, lig(i).fixtures->len - 1).week_number >= week)
|
||||
{
|
||||
free_league_stats(&lig(i).stats);
|
||||
lig(i).stats.teams_off = stat_update_league_teams(lig(i).teams, TEAM_COMPARE_OFFENSIVE);
|
||||
lig(i).stats.teams_def = stat_update_league_teams(lig(i).teams, TEAM_COMPARE_DEFENSE);
|
||||
lig(i).stats.league_name = g_strdup(lig(i).name);
|
||||
lig(i).stats.league_symbol = g_strdup(lig(i).symbol);
|
||||
lig(i).stats.teams_off =
|
||||
stat_update_league_teams(lig(i).teams, TEAM_COMPARE_OFFENSIVE);
|
||||
lig(i).stats.teams_def =
|
||||
stat_update_league_teams(lig(i).teams, TEAM_COMPARE_DEFENSE);
|
||||
stat_update_league_players(&lig(i));
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +109,7 @@ stat_update_league_players(League *league)
|
|||
for(j=0;j<maxlen;j++)
|
||||
{
|
||||
pl = (Player*)g_ptr_array_index(players_sorted[i], j);
|
||||
new_stat.team_id = pl->team->id;
|
||||
new_stat.team_name = g_strdup(pl->team->name);
|
||||
new_stat.value_string = g_strdup(pl->name);
|
||||
new_stat.value1 =
|
||||
player_games_goals_get(pl, pl->team->clid, PLAYER_VALUE_GOALS);
|
||||
|
@ -138,9 +144,11 @@ stat_update_league_teams(const GArray *teams_array, gint compare_type)
|
|||
|
||||
for(i=0;i<maxlen;i++)
|
||||
{
|
||||
new_stat.team_id = ((Team*)g_ptr_array_index(teams, i))->id;
|
||||
new_stat.value1 = team_get_table_value((Team*)g_ptr_array_index(teams, i), TABLE_GF);
|
||||
new_stat.value2 = team_get_table_value((Team*)g_ptr_array_index(teams, i), TABLE_GA);
|
||||
new_stat.team_name = g_strdup(((Team*)g_ptr_array_index(teams, i))->name);
|
||||
new_stat.value1 =
|
||||
team_get_table_value((Team*)g_ptr_array_index(teams, i), TABLE_GF);
|
||||
new_stat.value2 =
|
||||
team_get_table_value((Team*)g_ptr_array_index(teams, i), TABLE_GA);
|
||||
new_stat.value3 = -1;
|
||||
new_stat.value_string = NULL;
|
||||
|
||||
|
@ -182,7 +190,7 @@ stat_create_season_stat(void)
|
|||
g_array_append_val(new.league_champs, new_champ);
|
||||
|
||||
g_array_append_val(new.league_stats, lig(i).stats);
|
||||
lig(i).stats = stat_league_new(lig(i).id);
|
||||
lig(i).stats = stat_league_new(lig(i).name, lig(i).symbol);
|
||||
}
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
|
|
|
@ -34,7 +34,7 @@ SeasonStat
|
|||
stat_season_stat_new(gint season_number);
|
||||
|
||||
LeagueStat
|
||||
stat_league_new(gint clid);
|
||||
stat_league_new(const gchar *league_name, const gchar *league_symbol);
|
||||
|
||||
GArray*
|
||||
stat_update_league_teams(const GArray *teams, gint compare_type);
|
||||
|
|
|
@ -30,16 +30,17 @@
|
|||
string and integer values. */
|
||||
typedef struct
|
||||
{
|
||||
gint team_id;
|
||||
gchar *team_name;
|
||||
gint value1, value2, value3;
|
||||
gchar *value_string;
|
||||
} Stat;
|
||||
|
||||
/** A structure holding some stat arrays about a league. */
|
||||
typedef struct
|
||||
{
|
||||
/** The league id. */
|
||||
gint clid;
|
||||
{
|
||||
gchar *league_symbol;
|
||||
gchar *league_name;
|
||||
|
||||
/** Best offensive and defensive teams. */
|
||||
GArray *teams_off, *teams_def;
|
||||
/** Best goal getters and goalies. */
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
#define STRATEGY_H
|
||||
|
||||
#include "bygfoot.h"
|
||||
#include "player_struct.h"
|
||||
#include "strategy_struct.h"
|
||||
/* #include "team_struct.h" */
|
||||
#include "team_struct.h"
|
||||
#include "variables.h"
|
||||
|
||||
void
|
||||
|
|
|
@ -1,28 +1,3 @@
|
|||
/*
|
||||
support.c
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
|
|
@ -1,28 +1,3 @@
|
|||
/*
|
||||
support.h
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
|
27
src/team.c
27
src/team.c
|
@ -71,14 +71,14 @@ team_new(gboolean new_id)
|
|||
/* Fill the players array of the team and the stadium.
|
||||
@param tm The team that gets filled. */
|
||||
void
|
||||
team_generate_players_stadium(Team *tm)
|
||||
team_generate_players_stadium(Team *tm, gfloat av_talent)
|
||||
{
|
||||
gint i;
|
||||
gfloat skill_factor = math_rnd(1 - const_float("float_team_skill_variance"),
|
||||
1 + const_float("float_team_skill_variance"));
|
||||
Player new;
|
||||
gfloat wages = 0, average_talent;
|
||||
gchar *def_file = team_has_def_file(tm);
|
||||
gfloat wages = 0, average_talent, league_av_talent;
|
||||
gchar *def_file = team_has_def_file(tm);
|
||||
|
||||
tm->strategy_sid = strategy_get_random();
|
||||
|
||||
|
@ -89,9 +89,13 @@ team_generate_players_stadium(Team *tm)
|
|||
const_float("float_team_stadium_safety_upper"));
|
||||
|
||||
if(tm->clid < ID_CUP_START)
|
||||
{
|
||||
league_av_talent = (av_talent > 0) ?
|
||||
av_talent : league_from_clid(tm->clid)->average_talent;
|
||||
average_talent = (tm->average_talent == 0) ?
|
||||
skill_factor * league_from_clid(tm->clid)->average_talent :
|
||||
skill_factor * league_av_talent :
|
||||
tm->average_talent;
|
||||
}
|
||||
else
|
||||
average_talent =
|
||||
skill_factor * team_get_average_talents(lig(0).teams) *
|
||||
|
@ -321,6 +325,21 @@ team_is_user(const Team *tm)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/** Check whether the team with given name is a user-managed team.
|
||||
@param team_name The team name we examine.
|
||||
@return The user's index in the #users array or -1.*/
|
||||
gint
|
||||
team_name_is_user(const gchar *team_name)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<users->len;i++)
|
||||
if(strcmp(team_name, usr(i).tm->name) == 0)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Return the overall average skill or
|
||||
the cskill of the first 11 players.
|
||||
@param tm The team we examine.
|
||||
|
|
|
@ -50,7 +50,7 @@ gboolean
|
|||
query_is_my_team(const Team *tm);
|
||||
|
||||
void
|
||||
team_generate_players_stadium(Team *tm);
|
||||
team_generate_players_stadium(Team *tm, gfloat av_talent);
|
||||
|
||||
gboolean
|
||||
query_team_is_in_cups(const Team *tm, gint group);
|
||||
|
@ -73,6 +73,9 @@ team_get_average_skill(const Team *tm, gboolean cskill);
|
|||
gfloat
|
||||
team_get_average_talent(const Team *tm);
|
||||
|
||||
gint
|
||||
team_name_is_user(const gchar *team_name);
|
||||
|
||||
gint
|
||||
team_is_user(const Team *tm);
|
||||
|
||||
|
|
|
@ -936,14 +936,15 @@ treeview_create_fixture(const Fixture *fix, GtkListStore *ls)
|
|||
gchar *symbol[2] = {NULL, NULL};
|
||||
gchar buf_result[SMALL], buf[3][SMALL];
|
||||
gchar *colour_fg = NULL, *colour_bg = NULL;
|
||||
gint user_idx = fixture_user_team_involved(fix);
|
||||
|
||||
if(fix->clid >= ID_CUP_START &&
|
||||
query_cup_is_international(fix->clid))
|
||||
for(i=0;i<2;i++)
|
||||
symbol[i] = fix->teams[i]->symbol;
|
||||
|
||||
if(fixture_user_team_involved(fix) != -1)
|
||||
treeview_helper_set_user_colours(usr(fixture_user_team_involved(fix)).tm,
|
||||
if(user_idx != -1)
|
||||
treeview_helper_set_user_colours(usr(user_idx).tm->name,
|
||||
&colour_bg, &colour_fg);
|
||||
else
|
||||
{
|
||||
|
@ -2040,7 +2041,7 @@ treeview_create_user_history(void)
|
|||
gtk_list_store_set(ls, &iter,
|
||||
0, g_array_index(current_user.history, UserHistory, i).season,
|
||||
1, g_array_index(current_user.history, UserHistory, i).week,
|
||||
2, team_of_id(g_array_index(current_user.history, UserHistory, i).team_id)->name,
|
||||
2, g_array_index(current_user.history, UserHistory, i).team_name,
|
||||
4, buf, -1);
|
||||
|
||||
}
|
||||
|
@ -2129,9 +2130,10 @@ treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat)
|
|||
gchar *colour_fg = NULL, *colour_bg = NULL;
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
treeview_helper_insert_icon(ls, &iter, 0, league_from_clid(league_stat->clid)->symbol);
|
||||
treeview_helper_insert_icon(ls, &iter, 0,
|
||||
league_stat->league_symbol);
|
||||
gtk_list_store_set(ls, &iter, 1, const_int("int_treeview_helper_int_empty"),
|
||||
2, league_cup_get_name_string(league_stat->clid), 3, "", 4, "", 5, "", -1);
|
||||
2, league_stat->league_name, 3, "", 4, "", 5, "", -1);
|
||||
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
|
@ -2151,11 +2153,13 @@ treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat)
|
|||
g_array_index(teams[i], Stat, j).value1,
|
||||
g_array_index(teams[i], Stat, j).value2);
|
||||
|
||||
treeview_helper_set_user_colours(team_of_id(g_array_index(teams[i], Stat, j).team_id),
|
||||
&colour_bg, &colour_fg);
|
||||
treeview_helper_set_user_colours(
|
||||
g_array_index(teams[i], Stat, j).team_name,
|
||||
&colour_bg, &colour_fg);
|
||||
|
||||
sprintf(buf2, "<span background='%s' foreground='%s'>%s</span>",
|
||||
colour_bg, colour_fg, team_of_id(g_array_index(teams[i], Stat, j).team_id)->name);
|
||||
colour_bg, colour_fg,
|
||||
g_array_index(teams[i], Stat, j).team_name);
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
gtk_list_store_set(ls, &iter, 0, NULL, 1, j + 1,
|
||||
|
@ -2193,12 +2197,13 @@ treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat)
|
|||
100 * (1 - (gfloat)g_array_index(players[i], Stat, j).value1 /
|
||||
(gfloat)g_array_index(players[i], Stat, j).value3) : 0);
|
||||
|
||||
treeview_helper_set_user_colours(team_of_id(g_array_index(players[i], Stat, j).team_id),
|
||||
&colour_bg, &colour_fg);
|
||||
treeview_helper_set_user_colours(
|
||||
g_array_index(players[i], Stat, j).team_name,
|
||||
&colour_bg, &colour_fg);
|
||||
sprintf(buf3, "<span background='%s' foreground='%s'>%s (%s)</span>",
|
||||
colour_bg, colour_fg,
|
||||
g_array_index(players[i], Stat, j).value_string,
|
||||
team_of_id(g_array_index(players[i], Stat, j).team_id)->name);
|
||||
g_array_index(players[i], Stat, j).team_name);
|
||||
sprintf(buf4, "%d", g_array_index(players[i], Stat, j).value1);
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
|
@ -2300,11 +2305,12 @@ treeview_create_season_history_champions(GtkListStore *ls, const GArray* league_
|
|||
}
|
||||
}
|
||||
|
||||
/** Show the season history of the specified season
|
||||
and the specified page. Page is either a page of league stats
|
||||
/** Show the season history with given index in the season_stats array
|
||||
and the specified page.
|
||||
@param page Either a page of league stats
|
||||
(if != -1) or -1 which means we show the champions. */
|
||||
void
|
||||
treeview_show_season_history(gint page, gint season_number)
|
||||
treeview_show_season_history(gint page, gint idx)
|
||||
{
|
||||
gchar buf[SMALL];
|
||||
GtkTreeView *treeview = GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right"));
|
||||
|
@ -2312,24 +2318,24 @@ treeview_show_season_history(gint page, gint season_number)
|
|||
gtk_list_store_new(6, GDK_TYPE_PIXBUF, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING,
|
||||
G_TYPE_STRING, G_TYPE_STRING);
|
||||
GtkTreeIter iter;
|
||||
SeasonStat *stat = &g_array_index(season_stats, SeasonStat, season_number);
|
||||
SeasonStat *stat = &g_array_index(season_stats, SeasonStat, idx);
|
||||
|
||||
treeview_helper_clear(treeview);
|
||||
|
||||
treeview_set_up_league_stats(treeview);
|
||||
|
||||
sprintf(buf, _("Season %d"), season_number + 1);
|
||||
sprintf(buf, _("Season %d"), stat->season_number);
|
||||
gtk_list_store_append(model, &iter);
|
||||
gtk_list_store_set(model, &iter, 0, NULL,
|
||||
1, const_int("int_treeview_helper_int_empty"),
|
||||
2, buf, -1);
|
||||
|
||||
if(page != -1)
|
||||
treeview_create_league_stats(model,
|
||||
&g_array_index(stat->league_stats, LeagueStat, page));
|
||||
treeview_create_league_stats(
|
||||
model, &g_array_index(stat->league_stats, LeagueStat, page));
|
||||
else
|
||||
treeview_create_season_history_champions(model, stat->league_champs,
|
||||
stat->cup_champs);
|
||||
treeview_create_season_history_champions(
|
||||
model, stat->league_champs, stat->cup_champs);
|
||||
|
||||
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(model));
|
||||
g_object_unref(model);
|
||||
|
|
|
@ -211,7 +211,7 @@ void
|
|||
treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat);
|
||||
|
||||
void
|
||||
treeview_show_season_history(gint page, gint season_number);
|
||||
treeview_show_season_history(gint page, gint idx);
|
||||
|
||||
void
|
||||
treeview_create_season_history_champions(GtkListStore *ls, const GArray* league_champs,
|
||||
|
|
100
src/treeview2.c
100
src/treeview2.c
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "bet.h"
|
||||
#include "fixture.h"
|
||||
#include "job.h"
|
||||
#include "league.h"
|
||||
#include "live_game.h"
|
||||
#include "misc.h"
|
||||
|
@ -427,3 +428,102 @@ treeview2_show_bets(void)
|
|||
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(model));
|
||||
g_object_unref(model);
|
||||
}
|
||||
|
||||
void
|
||||
treeview2_create_job_exchange(GtkListStore *ls)
|
||||
{
|
||||
gint i;
|
||||
GtkTreeIter iter;
|
||||
gchar buf[SMALL];
|
||||
const Team *tm = NULL;
|
||||
|
||||
for(i=0;i<jobs->len;i++)
|
||||
{
|
||||
tm = job_get_team(&g_array_index(jobs, Job, i));
|
||||
sprintf(buf, "%s (%d)", g_array_index(jobs, Job, i).league_name,
|
||||
g_array_index(jobs, Job, i).league_layer);
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
gtk_list_store_set(ls, &iter, 0, i + 1,
|
||||
1, tm->name,
|
||||
2, buf,
|
||||
3, &g_array_index(jobs, Job, i),
|
||||
4, &g_array_index(jobs, Job, i),
|
||||
5, &g_array_index(jobs, Job, i),
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
treeview2_set_up_job_exchange(GtkTreeView *treeview)
|
||||
{
|
||||
gint i;
|
||||
GtkTreeViewColumn *col;
|
||||
GtkCellRenderer *renderer;
|
||||
gchar *titles[6] =
|
||||
{"",
|
||||
_("Team"),
|
||||
_("League"),
|
||||
_("Country"),
|
||||
_("Av.skill"),
|
||||
_("Talent %")};
|
||||
|
||||
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(treeview),
|
||||
GTK_SELECTION_SINGLE);
|
||||
gtk_tree_view_set_headers_visible(treeview, TRUE);
|
||||
|
||||
col = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_title(col, titles[0]);
|
||||
gtk_tree_view_append_column(treeview, col);
|
||||
renderer = treeview_helper_cell_renderer_text_new();
|
||||
gtk_tree_view_column_pack_start(col, renderer, TRUE);
|
||||
gtk_tree_view_column_add_attribute(col, renderer,
|
||||
"text", 0);
|
||||
|
||||
for(i=1;i<3;i++)
|
||||
{
|
||||
col = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_title(col, titles[i]);
|
||||
gtk_tree_view_append_column(treeview, col);
|
||||
renderer = treeview_helper_cell_renderer_text_new();
|
||||
gtk_tree_view_column_pack_start(col, renderer, TRUE);
|
||||
gtk_tree_view_column_add_attribute(col, renderer,
|
||||
"text", i);
|
||||
}
|
||||
|
||||
for(i=3;i<6;i++)
|
||||
{
|
||||
col = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_title(col, titles[i]);
|
||||
gtk_tree_view_append_column(treeview, col);
|
||||
renderer = treeview_helper_cell_renderer_text_new();
|
||||
gtk_tree_view_column_pack_start(col, renderer, TRUE);
|
||||
gtk_tree_view_column_set_cell_data_func(col, renderer,
|
||||
treeview_helper_job_exchange,
|
||||
NULL, NULL);
|
||||
if(i > 3)
|
||||
{
|
||||
gtk_tree_view_column_set_alignment(col, 0.5);
|
||||
g_object_set(renderer, "xalign", 0.5, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Show the teams that offer a job. */
|
||||
void
|
||||
treeview2_show_job_exchange(void)
|
||||
{
|
||||
GtkTreeView *treeview =
|
||||
GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right"));
|
||||
GtkListStore *model =
|
||||
gtk_list_store_new(6, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING,
|
||||
G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER);
|
||||
|
||||
treeview_helper_clear(treeview);
|
||||
|
||||
treeview2_set_up_job_exchange(treeview);
|
||||
|
||||
treeview2_create_job_exchange(model);
|
||||
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(model));
|
||||
g_object_unref(model);
|
||||
}
|
||||
|
|
|
@ -64,4 +64,13 @@ treeview2_set_up_bets(GtkTreeView *treeview);
|
|||
void
|
||||
treeview2_show_bets(void);
|
||||
|
||||
void
|
||||
treeview2_create_job_exchange(GtkListStore *ls);
|
||||
|
||||
void
|
||||
treeview2_set_up_job_exchange(GtkTreeView *treeview);
|
||||
|
||||
void
|
||||
treeview2_show_job_exchange(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "file.h"
|
||||
#include "fixture.h"
|
||||
#include "free.h"
|
||||
#include "job.h"
|
||||
#include "league.h"
|
||||
#include "misc.h"
|
||||
#include "option.h"
|
||||
|
@ -269,7 +270,7 @@ treeview_helper_get_user_history_icon(gint history_type)
|
|||
return NULL;
|
||||
case USER_HISTORY_START_GAME:
|
||||
return const_app("string_treeview_helper_user_history_symbol_start_game_icon");
|
||||
case USER_HISTORY_FIRE_FINANCES:
|
||||
case USER_HISTORY_FIRE_FINANCE:
|
||||
return const_app("string_treeview_helper_user_history_symbol_fire_finances_icon");
|
||||
case USER_HISTORY_FIRE_FAILURE:
|
||||
return const_app("string_treeview_helper_user_history_symbol_fire_failure_icon");
|
||||
|
@ -629,14 +630,15 @@ treeview_helper_get_table_element_colours(const Table *table, gint idx,
|
|||
/** Set the char pointers to the constant determining the background and foreground
|
||||
colours of user entries in treeviews if the team is a user team. */
|
||||
void
|
||||
treeview_helper_set_user_colours(const Team *tm, gchar **colour_bg, gchar **colour_fg)
|
||||
treeview_helper_set_user_colours(const gchar *team_name,
|
||||
gchar **colour_bg, gchar **colour_fg)
|
||||
{
|
||||
if(tm == current_user.tm)
|
||||
if(strcmp(team_name, current_user.tm->name) == 0)
|
||||
{
|
||||
*colour_fg = const_app("string_treeview_current_user_fg");
|
||||
*colour_bg = const_app("string_treeview_current_user_bg");
|
||||
}
|
||||
else if(team_is_user(tm) != -1)
|
||||
else if(team_name_is_user(team_name) != -1)
|
||||
{
|
||||
*colour_fg = const_app("string_treeview_user_fg");
|
||||
*colour_bg = const_app("string_treeview_user_bg");
|
||||
|
@ -993,7 +995,7 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col,
|
|||
gpointer user_data)
|
||||
{
|
||||
gint column = treeview_helper_get_col_number_column(col);
|
||||
gint attribute = GPOINTER_TO_INT(user_data);
|
||||
gint attribute = GPOINTER_TO_INT(user_data), idx = -1;
|
||||
gchar buf[SMALL];
|
||||
const Player *pl;
|
||||
|
||||
|
@ -1072,7 +1074,10 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col,
|
|||
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));
|
||||
idx = job_team_is_on_list(pl->team->id);
|
||||
strcpy(buf, (idx == -1) ?
|
||||
league_cup_get_name_string(pl->team->clid) :
|
||||
g_array_index(jobs, Job, idx).league_name);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1660,3 +1665,43 @@ treeview_helper_search_equal(GtkTreeModel *model,
|
|||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
void
|
||||
treeview_helper_job_exchange(GtkTreeViewColumn *col,
|
||||
GtkCellRenderer *renderer,
|
||||
GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint column = treeview_helper_get_col_number_column(col);
|
||||
gchar buf[SMALL];
|
||||
const Job *job = NULL;
|
||||
|
||||
gtk_tree_model_get(model, iter, column, &job, -1);
|
||||
|
||||
if(job == NULL)
|
||||
return;
|
||||
|
||||
g_object_set(renderer, "background",
|
||||
const_app("string_treeview_helper_color_default_background"),
|
||||
"foreground",
|
||||
const_app("string_treeview_helper_color_default_foreground"),
|
||||
NULL);
|
||||
|
||||
if(column == 3)
|
||||
{
|
||||
strcpy(buf, job->country_name);
|
||||
if(job->type != JOB_TYPE_NATIONAL)
|
||||
g_object_set(renderer, "background",
|
||||
const_app("string_treeview_helper_color_job_international_bg"),
|
||||
"foreground",
|
||||
const_app("string_treeview_helper_color_job_international_fg"),
|
||||
NULL);
|
||||
}
|
||||
else if(column == 4)
|
||||
sprintf(buf, "%.1f", team_get_average_skill(job_get_team(job), FALSE));
|
||||
else if(column == 5)
|
||||
sprintf(buf, "%d", job->talent_percent);
|
||||
|
||||
g_object_set(renderer, "text", buf, NULL);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,8 @@ treeview_helper_get_table_element_colour_cups_cup(const Cup *cup,
|
|||
const Team *tm, gchar **colour_bg);
|
||||
|
||||
void
|
||||
treeview_helper_set_user_colours(const Team *tm, gchar **colour_bg, gchar **colour_fg);
|
||||
treeview_helper_set_user_colours(const gchar *team_name,
|
||||
gchar **colour_bg, gchar **colour_fg);
|
||||
|
||||
PlayerListAttribute
|
||||
treeview_helper_get_attributes_from_scout(gint scout);
|
||||
|
@ -220,4 +221,12 @@ treeview_helper_search_equal(GtkTreeModel *model,
|
|||
GtkTreeIter *iter,
|
||||
gpointer search_data);
|
||||
|
||||
void
|
||||
treeview_helper_job_exchange(GtkTreeViewColumn *col,
|
||||
GtkCellRenderer *renderer,
|
||||
GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
233
src/user.c
233
src/user.c
|
@ -92,7 +92,9 @@ user_set_up_team_new_game(User *user)
|
|||
if(user->scout == -1)
|
||||
{
|
||||
user_set_up_team(user);
|
||||
user_history_add(user, USER_HISTORY_START_GAME, user->tm->id, user->tm->clid, -1, "");
|
||||
user_history_add(user, USER_HISTORY_START_GAME,
|
||||
user->tm->name,
|
||||
league_cup_get_name_string(user->tm->clid), NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -108,7 +110,9 @@ user_set_up_team_new_game(User *user)
|
|||
user->tm = &g_array_index(lig(user->scout).teams, Team, rndom);
|
||||
user->team_id = g_array_index(lig(user->scout).teams, Team, rndom).id;
|
||||
|
||||
user_history_add(user, USER_HISTORY_START_GAME, user->tm->id, user->tm->clid, -1, "");
|
||||
user_history_add(user, USER_HISTORY_START_GAME,
|
||||
user->tm->name,
|
||||
league_cup_get_name_string(user->tm->clid), NULL, NULL);
|
||||
|
||||
user_set_up_team(user);
|
||||
}
|
||||
|
@ -199,7 +203,7 @@ user_remove(gint idx, gboolean regenerate_team)
|
|||
g_array_free(usr(idx).tm->players, TRUE);
|
||||
usr(idx).tm->players = g_array_new(FALSE, FALSE, sizeof(Player));
|
||||
|
||||
team_generate_players_stadium(usr(idx).tm);
|
||||
team_generate_players_stadium(usr(idx).tm, 0);
|
||||
for(i=0;i<usr(idx).tm->players->len;i++)
|
||||
g_array_index(usr(idx).tm->players, Player, i).team = usr(idx).tm;
|
||||
}
|
||||
|
@ -293,10 +297,12 @@ user_job_offer(User *user)
|
|||
Team *new_team = NULL;
|
||||
|
||||
if(math_rnd(0, 1) > const_float("float_user_success_counter_check") ||
|
||||
ABS(user->counters[COUNT_USER_SUCCESS]) < (gfloat)const_int("int_user_success_offer_limit") * 0.9)
|
||||
ABS(user->counters[COUNT_USER_SUCCESS]) <
|
||||
(gfloat)const_int("int_user_success_offer_limit") * 0.9)
|
||||
return;
|
||||
|
||||
if(user->counters[COUNT_USER_SUCCESS] < -(gfloat)const_int("int_user_success_offer_limit") * 0.9 &&
|
||||
if(user->counters[COUNT_USER_SUCCESS] <
|
||||
-(gfloat)const_int("int_user_success_offer_limit") * 0.9 &&
|
||||
!user->counters[COUNT_USER_WARNING])
|
||||
{
|
||||
user_event_add(user, EVENT_TYPE_WARNING, -1, -1, NULL,
|
||||
|
@ -313,8 +319,6 @@ user_job_offer(User *user)
|
|||
{
|
||||
new_team = team_get_new(user->tm, TRUE);
|
||||
user_event_add(user, EVENT_TYPE_FIRE_FAILURE, -1, -1, new_team, NULL);
|
||||
user_history_add(user, USER_HISTORY_FIRE_FAILURE, user->tm->id,
|
||||
new_team->id, new_team->clid, "");
|
||||
}
|
||||
else if(option_int("int_opt_user_show_job_offers", &user->options))
|
||||
{
|
||||
|
@ -330,10 +334,11 @@ user_weekly_update_counters(User *user)
|
|||
{
|
||||
gint rank = team_get_league_rank(user->tm);
|
||||
gint teamslen = ((GArray*)(league_cup_get_teams(user->tm->clid)))->len;
|
||||
gint rank_bounds[2] = {(gint)rint(const_float("float_user_success_table_bound_upper") *
|
||||
(gfloat)teamslen),
|
||||
(gint)rint(const_float("float_user_success_table_bound_lower") *
|
||||
(gfloat)teamslen)};
|
||||
gint rank_bounds[2] =
|
||||
{(gint)rint(const_float("float_user_success_table_bound_upper") *
|
||||
(gfloat)teamslen),
|
||||
(gint)rint(const_float("float_user_success_table_bound_lower") *
|
||||
(gfloat)teamslen)};
|
||||
gint *cnts = user->counters;
|
||||
gint increase_capacity;
|
||||
gfloat increase_safety;
|
||||
|
@ -461,19 +466,16 @@ user_event_show_next(void)
|
|||
game_gui_show_warning(event->value_string);
|
||||
break;
|
||||
case EVENT_TYPE_FIRE_FINANCE:
|
||||
stat2 = STATUS_JOB_OFFER_FIRE_FINANCE;
|
||||
statp = event->value_pointer;
|
||||
game_gui_show_job_offer((Team*)event->value_pointer, STATUS_JOB_OFFER_FIRE_FINANCE);
|
||||
game_gui_show_job_offer((Team*)event->value_pointer, NULL,
|
||||
STATUS_JOB_OFFER_FIRE_FINANCE);
|
||||
break;
|
||||
case EVENT_TYPE_FIRE_FAILURE:
|
||||
stat2 = STATUS_JOB_OFFER_FIRE_FAILURE;
|
||||
statp = event->value_pointer;
|
||||
game_gui_show_job_offer((Team*)event->value_pointer, STATUS_JOB_OFFER_FIRE_FAILURE);
|
||||
game_gui_show_job_offer((Team*)event->value_pointer, NULL,
|
||||
STATUS_JOB_OFFER_FIRE_FAILURE);
|
||||
break;
|
||||
case EVENT_TYPE_JOB_OFFER:
|
||||
stat2 = STATUS_JOB_OFFER_SUCCESS;
|
||||
statp = event->value_pointer;
|
||||
game_gui_show_job_offer((Team*)event->value_pointer, STATUS_JOB_OFFER_SUCCESS);
|
||||
game_gui_show_job_offer((Team*)event->value_pointer, NULL,
|
||||
STATUS_JOB_OFFER_SUCCESS);
|
||||
break;
|
||||
case EVENT_TYPE_OVERDRAW:
|
||||
if(event->value1 == 1)
|
||||
|
@ -544,6 +546,7 @@ void
|
|||
user_change_team(User *user, Team *tm)
|
||||
{
|
||||
gint i;
|
||||
gint success = user->counters[COUNT_USER_SUCCESS];
|
||||
|
||||
user->tm = tm;
|
||||
user->team_id = tm->id;
|
||||
|
@ -551,6 +554,9 @@ user_change_team(User *user, Team *tm)
|
|||
user_set_up_team(user);
|
||||
|
||||
user->counters[COUNT_USER_NEW_SPONSOR] = 0;
|
||||
user->counters[COUNT_USER_SUCCESS] = (success < 0) ?
|
||||
0 : (gint)rint((gfloat)success / 2);
|
||||
|
||||
g_string_free(user->sponsor.name, TRUE);
|
||||
user->sponsor = user_get_sponsor(¤t_user);
|
||||
|
||||
|
@ -601,29 +607,38 @@ user_history_compare(gconstpointer a, gconstpointer b)
|
|||
|
||||
/** Add an element to the user history filled with the given values. */
|
||||
void
|
||||
user_history_add(User *user, gint type, gint team_id,
|
||||
gint value1, gint value2, gchar *string)
|
||||
user_history_add(User *user, gint type, const gchar *team_name,
|
||||
const gchar* string0, const gchar *string1,
|
||||
const gchar *string2)
|
||||
{
|
||||
gint i;
|
||||
UserHistory new_history;
|
||||
UserHistory *his = &new_history;
|
||||
gboolean replace = FALSE;
|
||||
|
||||
his->team_name = his->string[0] =
|
||||
his->string[1] = his->string[2] = NULL;
|
||||
|
||||
if(type == USER_HISTORY_WIN_FINAL ||
|
||||
type == USER_HISTORY_LOSE_FINAL ||
|
||||
type == USER_HISTORY_REACH_CUP_ROUND)
|
||||
{
|
||||
for(i=0;i<user->history->len;i++)
|
||||
if((g_array_index(user->history, UserHistory, i).type == USER_HISTORY_WIN_FINAL ||
|
||||
g_array_index(user->history, UserHistory, i).type == USER_HISTORY_LOSE_FINAL ||
|
||||
g_array_index(user->history, UserHistory, i).type == USER_HISTORY_REACH_CUP_ROUND) &&
|
||||
if((g_array_index(user->history, UserHistory, i).type ==
|
||||
USER_HISTORY_WIN_FINAL ||
|
||||
g_array_index(user->history, UserHistory, i).type ==
|
||||
USER_HISTORY_LOSE_FINAL ||
|
||||
g_array_index(user->history, UserHistory, i).type ==
|
||||
USER_HISTORY_REACH_CUP_ROUND) &&
|
||||
g_array_index(user->history, UserHistory, i).season == season &&
|
||||
g_array_index(user->history, UserHistory, i).team_id == team_id &&
|
||||
g_array_index(user->history, UserHistory, i).value1 == value1)
|
||||
strcmp(g_array_index(user->history, UserHistory, i).team_name,
|
||||
team_name) == 0 &&
|
||||
strcmp(g_array_index(user->history, UserHistory, i).string[1],
|
||||
string1) == 0)
|
||||
{
|
||||
/** Same cup round. */
|
||||
if(g_array_index(user->history, UserHistory, i).value2 == value2 &&
|
||||
if(strcmp(g_array_index(user->history, UserHistory, i).string[2],
|
||||
string2) == 0 &&
|
||||
type == USER_HISTORY_REACH_CUP_ROUND)
|
||||
return;
|
||||
|
||||
|
@ -633,47 +648,7 @@ user_history_add(User *user, gint type, gint team_id,
|
|||
}
|
||||
}
|
||||
|
||||
if(type == USER_HISTORY_WIN_FINAL)
|
||||
{
|
||||
if(query_cup_is_international(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_winner");
|
||||
else if(query_cup_is_national(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_winner");
|
||||
}
|
||||
else if(type == USER_HISTORY_LOSE_FINAL)
|
||||
{
|
||||
if(query_cup_is_international(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_final");
|
||||
else if(query_cup_is_national(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_winner");
|
||||
const_int("int_user_success_national_final");
|
||||
}
|
||||
else if(type == USER_HISTORY_REACH_CUP_ROUND)
|
||||
{
|
||||
if(value2 == cup_from_clid(value1)->rounds->len - 2)
|
||||
{
|
||||
if(query_cup_is_international(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_semis");
|
||||
else if(query_cup_is_national(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_semis");
|
||||
}
|
||||
else if(value2 == cup_from_clid(value1)->rounds->len - 3)
|
||||
{
|
||||
if(query_cup_is_international(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_quarter");
|
||||
else if(query_cup_is_national(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_quarter");
|
||||
}
|
||||
}
|
||||
else if(type == USER_HISTORY_PROMOTED)
|
||||
if(type == USER_HISTORY_PROMOTED)
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_promotion");
|
||||
else if(type == USER_HISTORY_RELEGATED)
|
||||
|
@ -682,20 +657,27 @@ user_history_add(User *user, gint type, gint team_id,
|
|||
|
||||
his->season = season;
|
||||
his->week = week;
|
||||
|
||||
his->type = type;
|
||||
his->team_id = team_id;
|
||||
his->value1 = value1;
|
||||
his->value2 = value2;
|
||||
|
||||
if(replace)
|
||||
{
|
||||
misc_string_assign(&his->value_string, string);
|
||||
if(string0 != NULL)
|
||||
misc_string_assign(&his->string[0], string0);
|
||||
if(string2 != NULL)
|
||||
misc_string_assign(&his->string[2], string2);
|
||||
g_array_sort(user->history, (GCompareFunc)user_history_compare);
|
||||
}
|
||||
else
|
||||
{
|
||||
his->value_string = g_strdup(string);
|
||||
his->team_name = g_strdup(team_name);
|
||||
|
||||
if(string0 != NULL)
|
||||
his->string[0] = g_strdup(string0);
|
||||
if(string1 != NULL)
|
||||
his->string[1] = g_strdup(string1);
|
||||
if(string2 != NULL)
|
||||
his->string[2] = g_strdup(string2);
|
||||
|
||||
g_array_prepend_val(user->history, *his);
|
||||
}
|
||||
}
|
||||
|
@ -705,8 +687,6 @@ user_history_add(User *user, gint type, gint team_id,
|
|||
void
|
||||
user_history_to_string(const UserHistory *history, gchar *buf)
|
||||
{
|
||||
gchar buf2[SMALL];
|
||||
|
||||
switch(history->type)
|
||||
{
|
||||
default:
|
||||
|
@ -715,73 +695,120 @@ user_history_to_string(const UserHistory *history, gchar *buf)
|
|||
case USER_HISTORY_START_GAME:
|
||||
/* Buy a team in a league. */
|
||||
sprintf(buf, _("You start the game with %s in the %s."),
|
||||
team_of_id(history->team_id)->name,
|
||||
league_cup_get_name_string(history->value1));
|
||||
history->team_name,
|
||||
history->string[0]);
|
||||
break;
|
||||
case USER_HISTORY_FIRE_FINANCES:
|
||||
case USER_HISTORY_FIRE_FINANCE:
|
||||
/* Team fires, team in a league. */
|
||||
sprintf(buf, _("%s fires you because of financial mismanagement.\nYou find a new job with %s in the %s."),
|
||||
team_of_id(history->team_id)->name,
|
||||
team_of_id(history->value1)->name,
|
||||
league_cup_get_name_string(history->value2));
|
||||
history->team_name,
|
||||
history->string[0],
|
||||
history->string[1]);
|
||||
break;
|
||||
case USER_HISTORY_FIRE_FAILURE:
|
||||
/* Team fires, team in a league. */
|
||||
sprintf(buf, _("%s fires you because of unsuccessfulness.\nYou find a new job with %s in the %s."),
|
||||
team_of_id(history->team_id)->name,
|
||||
team_of_id(history->value1)->name,
|
||||
league_cup_get_name_string(history->value2));
|
||||
history->team_name,
|
||||
history->string[0],
|
||||
history->string[1]);
|
||||
break;
|
||||
case USER_HISTORY_JOB_OFFER_ACCEPTED:
|
||||
/* Team in a league. Leave team. */
|
||||
sprintf(buf, _("%s offer you a job in the %s.\nYou accept the challenge and leave %s."),
|
||||
team_of_id(history->value1)->name,
|
||||
league_cup_get_name_string(history->value2),
|
||||
team_of_id(history->team_id)->name);
|
||||
history->string[0],
|
||||
history->string[1],
|
||||
history->team_name);
|
||||
break;
|
||||
case USER_HISTORY_END_SEASON:
|
||||
/* League name. */
|
||||
sprintf(buf, _("You finish the season in the %s on rank %d."),
|
||||
league_cup_get_name_string(history->value1),
|
||||
history->value2);
|
||||
sprintf(buf, _("You finish the season in the %s on rank %s."),
|
||||
history->string[0],
|
||||
history->string[1]);
|
||||
break;
|
||||
case USER_HISTORY_PROMOTED:
|
||||
/* League name. */
|
||||
sprintf(buf, _("You get promoted to the %s."),
|
||||
league_cup_get_name_string(history->value1));
|
||||
history->string[0]);
|
||||
break;
|
||||
case USER_HISTORY_RELEGATED:
|
||||
/* League name. */
|
||||
sprintf(buf, _("You get relegated to the %s."),
|
||||
league_cup_get_name_string(history->value1));
|
||||
history->string[0]);
|
||||
break;
|
||||
case USER_HISTORY_WIN_FINAL:
|
||||
/* Cup name, team name. */
|
||||
sprintf(buf, _("You win the %s final against %s."),
|
||||
league_cup_get_name_string(history->value1),
|
||||
history->value_string);
|
||||
history->string[0],
|
||||
history->string[1]);
|
||||
break;
|
||||
case USER_HISTORY_LOSE_FINAL:
|
||||
/* Cup name, team name. */
|
||||
sprintf(buf, _("You lose in the %s final against %s."),
|
||||
league_cup_get_name_string(history->value1),
|
||||
history->value_string);
|
||||
history->string[0],
|
||||
history->string[1]);
|
||||
break;
|
||||
case USER_HISTORY_REACH_CUP_ROUND:
|
||||
cup_get_round_name(cup_from_clid(history->value1), history->value2, buf2);
|
||||
/* Cup round name (e.g. Last 32), number, cup name. */
|
||||
sprintf(buf, _("You reach the %s (round %d) of the %s."), buf2,
|
||||
history->value2 + 1,
|
||||
league_cup_get_name_string(history->value1));
|
||||
sprintf(buf, _("You reach the %s (round %s) of the %s."),
|
||||
history->string[1],
|
||||
history->string[2],
|
||||
history->string[0]);
|
||||
break;
|
||||
case USER_HISTORY_CHAMPION:
|
||||
/* League name. */
|
||||
sprintf(buf, _("You are champion of the %s!"),
|
||||
league_cup_get_name_string(history->value1));
|
||||
history->string[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Increase the user success counter when the user
|
||||
is successful in a cup. */
|
||||
void
|
||||
user_add_cup_success(User *user, const Cup *cup, gint round, gint type)
|
||||
{
|
||||
if(type == USER_HISTORY_WIN_FINAL)
|
||||
{
|
||||
if(query_cup_is_international(cup->id))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_winner");
|
||||
else if(query_cup_is_national(cup->id))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_winner");
|
||||
}
|
||||
else if(type == USER_HISTORY_LOSE_FINAL)
|
||||
{
|
||||
if(query_cup_is_international(cup->id))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_final");
|
||||
else if(query_cup_is_national(cup->id))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_winner");
|
||||
const_int("int_user_success_national_final");
|
||||
}
|
||||
else if(type == USER_HISTORY_REACH_CUP_ROUND)
|
||||
{
|
||||
if(round == cup_from_clid(cup->id)->rounds->len - 2)
|
||||
{
|
||||
if(query_cup_is_international(cup->id))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_semis");
|
||||
else if(query_cup_is_national(cup->id))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_semis");
|
||||
}
|
||||
else if(round == cup_from_clid(cup->id)->rounds->len - 3)
|
||||
{
|
||||
if(query_cup_is_international(cup->id))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_quarter");
|
||||
else if(query_cup_is_national(cup->id))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_quarter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Find out whether there's a user who
|
||||
didn't have his turn before a new week round begins. */
|
||||
gboolean
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#define USER_H
|
||||
|
||||
#include "bygfoot.h"
|
||||
#include "cup_struct.h"
|
||||
#include "user_struct.h"
|
||||
#include "variables.h"
|
||||
|
||||
|
@ -89,8 +90,9 @@ gboolean
|
|||
query_user_teams_have_unfit(void);
|
||||
|
||||
void
|
||||
user_history_add(User *user, gint type, gint team_id,
|
||||
gint value1, gint value2, gchar *string);
|
||||
user_history_add(User *user, gint type, const gchar *team_name,
|
||||
const gchar* string0, const gchar *string1,
|
||||
const gchar *string2);
|
||||
|
||||
void
|
||||
user_history_to_string(const UserHistory *history, gchar *buf);
|
||||
|
@ -98,6 +100,9 @@ user_history_to_string(const UserHistory *history, gchar *buf);
|
|||
gint
|
||||
user_history_compare(gconstpointer a, gconstpointer b);
|
||||
|
||||
void
|
||||
user_add_cup_success(User *user, const Cup *cup, gint round, gint type);
|
||||
|
||||
void
|
||||
user_job_offer(User *user);
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ enum CounterValue
|
|||
enum UserHistoryType
|
||||
{
|
||||
USER_HISTORY_START_GAME = 0,
|
||||
USER_HISTORY_FIRE_FINANCES,
|
||||
USER_HISTORY_FIRE_FINANCE,
|
||||
USER_HISTORY_FIRE_FAILURE,
|
||||
USER_HISTORY_JOB_OFFER_ACCEPTED,
|
||||
USER_HISTORY_END_SEASON,
|
||||
|
@ -123,14 +123,13 @@ typedef struct
|
|||
/** When the event happened. */
|
||||
gint season, week;
|
||||
|
||||
/** The type (see #UserHistoryType) and team
|
||||
of the user. */
|
||||
gint type, team_id,
|
||||
/** These can hold various information like
|
||||
team or league/cup ids. */
|
||||
value1, value2;
|
||||
gchar *value_string;
|
||||
|
||||
/** The type (see #UserHistoryType) of the history event. */
|
||||
gint type;
|
||||
/** The team of the user at the time. */
|
||||
gchar *team_name;
|
||||
/** These can hold various information like
|
||||
team or league/cup ids. */
|
||||
gchar *string[3];
|
||||
} UserHistory;
|
||||
|
||||
/** A user sponsor. */
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#include "enums.h"
|
||||
#include "live_game_struct.h"
|
||||
#include "option_struct.h"
|
||||
#include "player_struct.h"
|
||||
#include "stat_struct.h"
|
||||
#include "team_struct.h"
|
||||
#include "user_struct.h"
|
||||
|
||||
/**
|
||||
* The main variable of the game.
|
||||
|
@ -76,6 +72,10 @@ GArray *strategies;
|
|||
/** Array of current and recent bets. */
|
||||
GArray *bets[2];
|
||||
|
||||
/** Array of jobs in the job exchange and
|
||||
teams going with the international jobs. */
|
||||
GArray *jobs, *job_teams;
|
||||
|
||||
/** Some counters we use. */
|
||||
gint counters[COUNT_END];
|
||||
|
||||
|
|
|
@ -649,6 +649,9 @@ window_create(gint window_type)
|
|||
window.main = create_main_window();
|
||||
wind = window.main;
|
||||
window_main_load_geometry();
|
||||
window.paned_pos =
|
||||
gtk_paned_get_position(
|
||||
GTK_PANED(lookup_widget(window.main, "hpaned2")));
|
||||
game_gui_print_message(_("Welcome to Bygfoot %s"), VERS);
|
||||
sprintf(buf, "Bygfoot Football Manager %s", VERS);
|
||||
}
|
||||
|
@ -719,10 +722,7 @@ window_create(gint window_type)
|
|||
if(window.job_offer != NULL)
|
||||
g_warning("window_create: called on already existing window\n");
|
||||
else
|
||||
{
|
||||
popups_active++;
|
||||
window.job_offer = create_window_job_offer();
|
||||
}
|
||||
wind = window.job_offer;
|
||||
strcpy(buf, _("Job offer"));
|
||||
break;
|
||||
|
|
|
@ -71,6 +71,7 @@ enum XmlTags
|
|||
#define TAG_START_SEASON_STATS 11000
|
||||
#define TAG_START_LEAGUES_CUPS 12000
|
||||
#define TAG_START_TRANSFERS 20000
|
||||
#define TAG_START_JOBS 21000
|
||||
|
||||
#define xml_write_g_string(fil, gstring, tag, indent) xml_write_string(fil, (gstring)->str, tag, indent)
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
*/
|
||||
#define TAG_COUNTRY "country"
|
||||
#define TAG_NAME "name"
|
||||
#define TAG_RATING "rating"
|
||||
#define TAG_SYMBOL "symbol"
|
||||
#define TAG_SID "sid"
|
||||
#define TAG_SUPERNATIONAL "supernational"
|
||||
|
@ -52,6 +53,7 @@ enum XmlCountryStates
|
|||
{
|
||||
STATE_COUNTRY = 0,
|
||||
STATE_NAME,
|
||||
STATE_RATING,
|
||||
STATE_SYMBOL,
|
||||
STATE_SID,
|
||||
STATE_SUPERNATIONAL,
|
||||
|
@ -66,6 +68,7 @@ enum XmlCountryStates
|
|||
* The state variable used in the XML parsing functions.
|
||||
*/
|
||||
gint state;
|
||||
Country *cntry;
|
||||
|
||||
/**
|
||||
* The function called by the parser when an opening tag is read.
|
||||
|
@ -83,6 +86,8 @@ xml_country_read_start_element (GMarkupParseContext *context,
|
|||
{
|
||||
if(strcmp(element_name, TAG_NAME) == 0)
|
||||
state = STATE_NAME;
|
||||
else if(strcmp(element_name, TAG_RATING) == 0)
|
||||
state = STATE_RATING;
|
||||
else if(strcmp(element_name, TAG_SYMBOL) == 0)
|
||||
state = STATE_SYMBOL;
|
||||
else if(strcmp(element_name, TAG_SID) == 0)
|
||||
|
@ -92,16 +97,16 @@ xml_country_read_start_element (GMarkupParseContext *context,
|
|||
else if(strcmp(element_name, TAG_LEAGUES) == 0)
|
||||
{
|
||||
state = STATE_LEAGUES;
|
||||
if(ligs == NULL)
|
||||
ligs = g_array_new(FALSE, FALSE, sizeof(League));
|
||||
if(cntry->leagues == NULL)
|
||||
cntry->leagues = g_array_new(FALSE, FALSE, sizeof(League));
|
||||
}
|
||||
else if(strcmp(element_name, TAG_LEAGUE) == 0)
|
||||
state = STATE_LEAGUE;
|
||||
else if(strcmp(element_name, TAG_CUPS) == 0)
|
||||
{
|
||||
state = STATE_CUPS;
|
||||
if(cps == NULL)
|
||||
cps = g_array_new(FALSE, FALSE, sizeof(Cup));
|
||||
if(cntry->cups == NULL)
|
||||
cntry->cups = g_array_new(FALSE, FALSE, sizeof(Cup));
|
||||
}
|
||||
else if(strcmp(element_name, TAG_CUP) == 0)
|
||||
state = STATE_CUP;
|
||||
|
@ -122,6 +127,7 @@ xml_country_read_end_element (GMarkupParseContext *context,
|
|||
GError **error)
|
||||
{
|
||||
if(strcmp(element_name, TAG_NAME) == 0 ||
|
||||
strcmp(element_name, TAG_RATING) == 0 ||
|
||||
strcmp(element_name, TAG_SYMBOL) == 0 ||
|
||||
strcmp(element_name, TAG_SID) == 0 ||
|
||||
strcmp(element_name, TAG_SUPERNATIONAL) == 0 ||
|
||||
|
@ -160,12 +166,14 @@ xml_country_read_text (GMarkupParseContext *context,
|
|||
int_value = (gint)g_ascii_strtod(buf, NULL);
|
||||
|
||||
if(state == STATE_NAME)
|
||||
misc_string_assign(&country.name, buf);
|
||||
misc_string_assign(&cntry->name, buf);
|
||||
else if(state == STATE_RATING)
|
||||
cntry->rating = int_value;
|
||||
else if(state == STATE_SYMBOL)
|
||||
misc_string_assign(&country.symbol, buf);
|
||||
misc_string_assign(&cntry->symbol, buf);
|
||||
else if(state == STATE_SID)
|
||||
misc_string_assign(&country.sid, buf);
|
||||
else if(state == STATE_SUPERNATIONAL)
|
||||
misc_string_assign(&cntry->sid, buf);
|
||||
else if(state == STATE_SUPERNATIONAL && cntry == &country)
|
||||
{
|
||||
sett_set_int("int_opt_disable_finances", 1);
|
||||
sett_set_int("int_opt_disable_transfers", 1);
|
||||
|
@ -175,22 +183,22 @@ xml_country_read_text (GMarkupParseContext *context,
|
|||
sett_set_int("int_opt_disable_ya", 1);
|
||||
}
|
||||
else if(state == STATE_LEAGUE)
|
||||
xml_league_read(buf, ligs);
|
||||
xml_league_read(buf, cntry->leagues);
|
||||
else if(state == STATE_CUP)
|
||||
xml_cup_read(buf, cps);
|
||||
xml_cup_read(buf, cntry->cups);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function reading an XML file specifying a country.
|
||||
* The variable #country gets freed and overwritten afterwards.
|
||||
* @param country_name name of the xml file (e.g. 'country_england.xml')
|
||||
* to be read. Full path is not necessary, if the file is located in
|
||||
* one of the suppport directories; neither are the prefix 'country_'
|
||||
* or the suffix '.xml'.
|
||||
Function reading an XML file specifying a country.
|
||||
@param country_name name of the xml file (e.g. 'country_england.xml')
|
||||
to be read. Full path is not necessary, if the file is located in
|
||||
one of the suppport directories; neither are the prefix 'country_'
|
||||
or the suffix '.xml'.
|
||||
@param cntry The country variable to write.
|
||||
*/
|
||||
void
|
||||
xml_country_read(const gchar *country_name)
|
||||
xml_country_read(const gchar *country_name, Country *cntry_arg)
|
||||
{
|
||||
gchar *file_name = file_find_support_file(country_name, FALSE);
|
||||
GMarkupParser parser = {xml_country_read_start_element,
|
||||
|
@ -219,18 +227,23 @@ xml_country_read(const gchar *country_name)
|
|||
return;
|
||||
}
|
||||
|
||||
cntry = (cntry_arg == NULL) ? &country : cntry_arg;
|
||||
|
||||
state = STATE_COUNTRY;
|
||||
strcpy(buf, file_name);
|
||||
g_free(file_name);
|
||||
|
||||
free_country(TRUE);
|
||||
free_country(cntry, TRUE);
|
||||
|
||||
sett_set_int("int_opt_disable_finances", 0);
|
||||
sett_set_int("int_opt_disable_transfers", 0);
|
||||
sett_set_int("int_opt_disable_stadium", 0);
|
||||
sett_set_int("int_opt_disable_contracts", 0);
|
||||
sett_set_int("int_opt_disable_boost_on", 0);
|
||||
sett_set_int("int_opt_disable_ya", 0);
|
||||
if(cntry_arg == NULL)
|
||||
{
|
||||
sett_set_int("int_opt_disable_finances", 0);
|
||||
sett_set_int("int_opt_disable_transfers", 0);
|
||||
sett_set_int("int_opt_disable_stadium", 0);
|
||||
sett_set_int("int_opt_disable_contracts", 0);
|
||||
sett_set_int("int_opt_disable_boost_on", 0);
|
||||
sett_set_int("int_opt_disable_ya", 0);
|
||||
}
|
||||
|
||||
if(g_markup_parse_context_parse(context, file_contents, length, &error))
|
||||
{
|
||||
|
@ -244,7 +257,7 @@ xml_country_read(const gchar *country_name)
|
|||
misc_print_error(&error, TRUE);
|
||||
}
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(lig(i).layer == -1)
|
||||
lig(i).layer = i + 1;
|
||||
for(i=0;i<cntry->leagues->len;i++)
|
||||
if(g_array_index(cntry->leagues, League, i).layer == -1)
|
||||
g_array_index(cntry->leagues, League, i).layer = i + 1;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,6 @@ xml_country_read_text (GMarkupParseContext *context,
|
|||
|
||||
|
||||
void
|
||||
xml_country_read(const gchar *country_name);
|
||||
xml_country_read(const gchar *country_name, Country *cntry_arg);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -133,7 +133,7 @@ xml_league_read_start_element (GMarkupParseContext *context,
|
|||
{
|
||||
PromRelElement new_element;
|
||||
Team new_team;
|
||||
|
||||
|
||||
if(strcmp(element_name, TAG_LEAGUE) == 0)
|
||||
{
|
||||
new_league = league_new(TRUE);
|
||||
|
|
|
@ -33,11 +33,14 @@
|
|||
enum
|
||||
{
|
||||
TAG_LEAGUE_STAT = TAG_START_LEAGUE_STAT,
|
||||
TAG_STAT_LEAGUE_NAME,
|
||||
TAG_STAT_LEAGUE_SYMBOL,
|
||||
TAG_STAT_TEAMS_OFF,
|
||||
TAG_STAT_TEAMS_DEF,
|
||||
TAG_STAT_PLAYER_SCORERS,
|
||||
TAG_STAT_PLAYER_GOALIES,
|
||||
TAG_STAT,
|
||||
TAG_STAT_TEAM_NAME,
|
||||
TAG_STAT_VALUE,
|
||||
TAG_STAT_VALUE_STRING,
|
||||
TAG_END
|
||||
|
@ -66,17 +69,11 @@ xml_loadsave_league_stat_start_element (GMarkupParseContext *context,
|
|||
valid_tag = TRUE;
|
||||
}
|
||||
|
||||
for(i=TAG_NAME;i<=TAG_ROUND;i++)
|
||||
if(tag == i)
|
||||
{
|
||||
state = i;
|
||||
valid_tag = TRUE;
|
||||
}
|
||||
|
||||
if(tag == TAG_STAT)
|
||||
{
|
||||
valueidx = 0;
|
||||
new_stat.value_string = NULL;
|
||||
new_stat.value_string =
|
||||
new_stat.team_name = NULL;
|
||||
}
|
||||
else if(tag == TAG_STAT_TEAMS_OFF ||
|
||||
tag == TAG_STAT_TEAMS_DEF ||
|
||||
|
@ -85,8 +82,9 @@ xml_loadsave_league_stat_start_element (GMarkupParseContext *context,
|
|||
in_state = tag;
|
||||
|
||||
if(!valid_tag)
|
||||
g_warning("xml_loadsave_league_stat_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
g_warning(
|
||||
"xml_loadsave_league_stat_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -98,7 +96,8 @@ xml_loadsave_league_stat_end_element (GMarkupParseContext *context,
|
|||
GArray *stat_array = NULL;
|
||||
gint tag = xml_get_tag_from_name(element_name);
|
||||
|
||||
if(tag == TAG_ID ||
|
||||
if(tag == TAG_STAT_LEAGUE_NAME ||
|
||||
tag == TAG_STAT_LEAGUE_SYMBOL ||
|
||||
tag == TAG_STAT_TEAMS_OFF ||
|
||||
tag == TAG_STAT_TEAMS_DEF ||
|
||||
tag == TAG_STAT_PLAYER_SCORERS ||
|
||||
|
@ -127,15 +126,16 @@ xml_loadsave_league_stat_end_element (GMarkupParseContext *context,
|
|||
else if(tag == TAG_STAT_VALUE_STRING ||
|
||||
tag == TAG_STAT_VALUE ||
|
||||
tag == TAG_STAT_VALUE_STRING ||
|
||||
tag == TAG_TEAM_ID)
|
||||
tag == TAG_STAT_TEAM_NAME)
|
||||
{
|
||||
state = TAG_STAT;
|
||||
if(tag == TAG_STAT_VALUE)
|
||||
valueidx++;
|
||||
}
|
||||
else if(tag != TAG_LEAGUE_STAT)
|
||||
g_warning("xml_loadsave_league_stat_end_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
g_warning(
|
||||
"xml_loadsave_league_stat_end_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -153,10 +153,12 @@ xml_loadsave_league_stat_text (GMarkupParseContext *context,
|
|||
|
||||
int_value = (gint)g_ascii_strtod(buf, NULL);
|
||||
|
||||
if(state == TAG_ID)
|
||||
lig_stat->clid = int_value;
|
||||
else if(state == TAG_TEAM_ID)
|
||||
new_stat.team_id = int_value;
|
||||
if(state == TAG_STAT_LEAGUE_NAME)
|
||||
lig_stat->league_name = g_strdup(buf);
|
||||
else if(state == TAG_STAT_LEAGUE_SYMBOL)
|
||||
lig_stat->league_symbol = g_strdup(buf);
|
||||
else if(state == TAG_STAT_TEAM_NAME)
|
||||
new_stat.team_name = g_strdup(buf);
|
||||
else if(state == TAG_STAT_VALUE)
|
||||
{
|
||||
if(valueidx == 0)
|
||||
|
@ -215,7 +217,8 @@ xml_loadsave_league_stat_write(const gchar *filename, const LeagueStat *league_s
|
|||
|
||||
fprintf(fil, "<_%d>\n", TAG_LEAGUE_STAT);
|
||||
|
||||
xml_write_int(fil, league_stat->clid, TAG_ID, I0);
|
||||
xml_write_string(fil, league_stat->league_name, TAG_STAT_LEAGUE_NAME, I0);
|
||||
xml_write_string(fil, league_stat->league_symbol, TAG_STAT_LEAGUE_SYMBOL, I0);
|
||||
|
||||
fprintf(fil, "<_%d>\n", TAG_STAT_TEAMS_OFF);
|
||||
for(i=0;i<league_stat->teams_off->len;i++)
|
||||
|
@ -251,7 +254,7 @@ xml_loadsave_league_stat_write_stat(FILE *fil, const Stat *stat)
|
|||
{
|
||||
fprintf(fil, "%s<_%d>\n", I1, TAG_STAT);
|
||||
|
||||
xml_write_int(fil, stat->team_id, TAG_TEAM_ID, I1);
|
||||
xml_write_string(fil, stat->team_name, TAG_STAT_TEAM_NAME, I1);
|
||||
xml_write_int(fil, stat->value1, TAG_STAT_VALUE, I1);
|
||||
xml_write_int(fil, stat->value2, TAG_STAT_VALUE, I1);
|
||||
xml_write_int(fil, stat->value3, TAG_STAT_VALUE, I1);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
enum XmlLoadSaveCountryTags
|
||||
{
|
||||
TAG_MISC = TAG_START_MISC,
|
||||
TAG_MISC_RATING,
|
||||
TAG_MISC_SEASON,
|
||||
TAG_MISC_WEEK,
|
||||
TAG_MISC_WEEK_ROUND,
|
||||
|
@ -105,6 +106,7 @@ xml_loadsave_misc_end_element (GMarkupParseContext *context,
|
|||
if(tag == TAG_NAME ||
|
||||
tag == TAG_SYMBOL ||
|
||||
tag == TAG_SID ||
|
||||
tag == TAG_MISC_RATING ||
|
||||
tag == TAG_MISC_ALLCUP ||
|
||||
tag == TAG_MISC_COUNTER ||
|
||||
tag == TAG_MISC_SEASON ||
|
||||
|
@ -151,6 +153,8 @@ xml_loadsave_misc_text (GMarkupParseContext *context,
|
|||
|
||||
if(state == TAG_NAME)
|
||||
misc_string_assign(&country.name, buf);
|
||||
else if(state == TAG_MISC_RATING)
|
||||
country.rating = int_value;
|
||||
else if(state == TAG_SYMBOL)
|
||||
misc_string_assign(&country.symbol, buf);
|
||||
else if(state == TAG_SID)
|
||||
|
@ -231,6 +235,7 @@ xml_loadsave_misc_write(const gchar *prefix)
|
|||
xml_write_string(fil, country.name, TAG_NAME, I0);
|
||||
xml_write_string(fil, country.symbol, TAG_SYMBOL, I0);
|
||||
xml_write_string(fil, country.sid, TAG_SID, I0);
|
||||
xml_write_int(fil, country.rating, TAG_MISC_RATING, I0);
|
||||
xml_write_int(fil, season, TAG_MISC_SEASON, I0);
|
||||
xml_write_int(fil, week, TAG_MISC_WEEK, I0);
|
||||
xml_write_int(fil, week_round, TAG_MISC_WEEK_ROUND, I0);
|
||||
|
|
|
@ -149,7 +149,7 @@ xml_loadsave_season_stats_text (GMarkupParseContext *context,
|
|||
new_champ_stat.cl_name = g_strdup(buf);
|
||||
else if(state == TAG_LEAGUE_STAT_FILE)
|
||||
{
|
||||
new_league_stat = stat_league_new(-1);
|
||||
new_league_stat = stat_league_new("", "");
|
||||
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);
|
||||
|
|
|
@ -52,10 +52,8 @@ enum
|
|||
TAG_USER_HISTORY_SEASON,
|
||||
TAG_USER_HISTORY_WEEK,
|
||||
TAG_USER_HISTORY_TYPE,
|
||||
TAG_USER_HISTORY_TEAM_ID,
|
||||
TAG_USER_HISTORY_VALUE1,
|
||||
TAG_USER_HISTORY_VALUE2,
|
||||
TAG_USER_HISTORY_VALUE_STRING,
|
||||
TAG_USER_HISTORY_TEAM_NAME,
|
||||
TAG_USER_HISTORY_STRING,
|
||||
TAG_USER_EVENT,
|
||||
TAG_USER_EVENT_TYPE,
|
||||
TAG_USER_EVENT_VALUE1,
|
||||
|
@ -114,8 +112,7 @@ xml_loadsave_users_start_element (GMarkupParseContext *context,
|
|||
new_user = user_new();
|
||||
idx = idx_mon_out = idx_mon_in = 0;
|
||||
}
|
||||
|
||||
if(tag >= TAG_START_PLAYERS && tag <= TAG_END_PLAYERS)
|
||||
else if(tag >= TAG_START_PLAYERS && tag <= TAG_END_PLAYERS)
|
||||
{
|
||||
state = TAG_START_PLAYERS;
|
||||
valid_tag = TRUE;
|
||||
|
@ -125,19 +122,22 @@ xml_loadsave_users_start_element (GMarkupParseContext *context,
|
|||
|
||||
xml_loadsave_players_start_element(tag, new_user.tm);
|
||||
}
|
||||
|
||||
if(state == TAG_USER_MONEY_OUTS ||
|
||||
state == TAG_USER_MONEY_INS)
|
||||
else if(tag == TAG_USER_HISTORY)
|
||||
{
|
||||
idx = 0;
|
||||
|
||||
if(state == TAG_USER_BET0 ||
|
||||
state == TAG_USER_BET1)
|
||||
idx_bet = (state == TAG_USER_BET1);
|
||||
|
||||
if(tag == TAG_USER_HISTORY)
|
||||
new_history.value_string = NULL;
|
||||
new_history.team_name =
|
||||
new_history.string[0] =
|
||||
new_history.string[1] =
|
||||
new_history.string[2] = NULL;
|
||||
}
|
||||
else if(tag == TAG_USER_EVENT)
|
||||
new_event.value_string = NULL;
|
||||
else if(tag == TAG_USER_MONEY_OUTS ||
|
||||
tag == TAG_USER_MONEY_INS)
|
||||
idx = 0;
|
||||
else if(tag == TAG_USER_BET0 ||
|
||||
tag == TAG_USER_BET1)
|
||||
idx_bet = (tag == TAG_USER_BET1);
|
||||
|
||||
if(!valid_tag)
|
||||
g_warning("xml_loadsave_users_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
|
@ -207,11 +207,14 @@ xml_loadsave_users_end_element (GMarkupParseContext *context,
|
|||
else if(tag == TAG_USER_HISTORY_SEASON ||
|
||||
tag == TAG_USER_HISTORY_WEEK ||
|
||||
tag == TAG_USER_HISTORY_TYPE ||
|
||||
tag == TAG_USER_HISTORY_TEAM_ID ||
|
||||
tag == TAG_USER_HISTORY_VALUE1 ||
|
||||
tag == TAG_USER_HISTORY_VALUE2 ||
|
||||
tag == TAG_USER_HISTORY_VALUE_STRING)
|
||||
tag == TAG_USER_HISTORY_TEAM_NAME ||
|
||||
tag == TAG_USER_HISTORY_STRING)
|
||||
{
|
||||
state = TAG_USER_HISTORY;
|
||||
|
||||
if(tag == TAG_USER_HISTORY_STRING)
|
||||
idx++;
|
||||
}
|
||||
else if(tag == TAG_USER_EVENT_TYPE ||
|
||||
tag == TAG_USER_EVENT_VALUE1 ||
|
||||
tag == TAG_USER_EVENT_VALUE2 ||
|
||||
|
@ -286,14 +289,10 @@ xml_loadsave_users_text (GMarkupParseContext *context,
|
|||
new_history.week = int_value;
|
||||
else if(state == TAG_USER_HISTORY_TYPE)
|
||||
new_history.type = int_value;
|
||||
else if(state == TAG_USER_HISTORY_TEAM_ID)
|
||||
new_history.team_id = int_value;
|
||||
else if(state == TAG_USER_HISTORY_VALUE1)
|
||||
new_history.value1 = int_value;
|
||||
else if(state == TAG_USER_HISTORY_VALUE2)
|
||||
new_history.value2 = int_value;
|
||||
else if(state == TAG_USER_HISTORY_VALUE_STRING)
|
||||
misc_string_assign(&new_history.value_string, buf);
|
||||
else if(state == TAG_USER_HISTORY_TEAM_NAME)
|
||||
new_history.team_name = g_strdup(buf);
|
||||
else if(state == TAG_USER_HISTORY_STRING)
|
||||
new_history.string[idx] = (strlen(buf) == 0) ? NULL : g_strdup(buf);
|
||||
else if(state == TAG_USER_EVENT_TYPE)
|
||||
new_event.type = int_value;
|
||||
else if(state == TAG_USER_EVENT_VALUE1)
|
||||
|
@ -301,7 +300,7 @@ xml_loadsave_users_text (GMarkupParseContext *context,
|
|||
else if(state == TAG_USER_EVENT_VALUE2)
|
||||
new_event.value2 = int_value;
|
||||
else if(state == TAG_USER_EVENT_VALUE_STRING)
|
||||
misc_string_assign(&new_event.value_string, buf);
|
||||
new_event.value_string = g_strdup(buf);
|
||||
else if(state == TAG_USER_YA_COACH)
|
||||
new_user.youth_academy.coach = int_value;
|
||||
else if(state == TAG_USER_YA_PERCENTAGE)
|
||||
|
@ -439,7 +438,7 @@ xml_loadsave_users_write(const gchar *prefix)
|
|||
void
|
||||
xml_user_write_history(FILE *fil, const GArray *history)
|
||||
{
|
||||
gint i;
|
||||
gint i, j;
|
||||
|
||||
for(i=0;i<history->len;i++)
|
||||
{
|
||||
|
@ -451,14 +450,14 @@ xml_user_write_history(FILE *fil, const GArray *history)
|
|||
TAG_USER_HISTORY_WEEK, I2);
|
||||
xml_write_int(fil, g_array_index(history, UserHistory, i).type,
|
||||
TAG_USER_HISTORY_TYPE, I2);
|
||||
xml_write_int(fil, g_array_index(history, UserHistory, i).team_id,
|
||||
TAG_USER_HISTORY_TEAM_ID, I2);
|
||||
xml_write_int(fil, g_array_index(history, UserHistory, i).value1,
|
||||
TAG_USER_HISTORY_VALUE1, I2);
|
||||
xml_write_int(fil, g_array_index(history, UserHistory, i).value2,
|
||||
TAG_USER_HISTORY_VALUE2, I2);
|
||||
xml_write_string(fil, g_array_index(history, UserHistory, i).value_string,
|
||||
TAG_USER_HISTORY_VALUE_STRING, I2);
|
||||
xml_write_string(fil, g_array_index(history, UserHistory, i).team_name,
|
||||
TAG_USER_HISTORY_TEAM_NAME, I2);
|
||||
for(j=0;j<3;j++)
|
||||
if(g_array_index(history, UserHistory, i).string[j] != NULL)
|
||||
xml_write_string(fil, g_array_index(history, UserHistory, i).string[j],
|
||||
TAG_USER_HISTORY_STRING, I2);
|
||||
else
|
||||
xml_write_string(fil, "", TAG_USER_HISTORY_STRING, I2);
|
||||
|
||||
fprintf(fil, "%s</_%d>\n", I1, TAG_USER_HISTORY);
|
||||
}
|
||||
|
|
|
@ -230,3 +230,7 @@ string_treeview_helper_player_status_yellow_danger player_status_yellow.png
|
|||
# betting cell
|
||||
string_treeview_helper_color_user_bet_fg black
|
||||
string_treeview_helper_color_user_bet_bg lightblue
|
||||
|
||||
# colours for foreign countries in the job exchange list
|
||||
string_treeview_helper_color_job_international_fg black
|
||||
string_treeview_helper_color_job_international_bg lightblue
|
||||
|
|
|
@ -895,3 +895,29 @@ float_bet_wager_limit_factor 50000
|
|||
|
||||
# how much the user may wager at most
|
||||
int_bet_wager_max 25000
|
||||
|
||||
# lower and upper bounds for the number
|
||||
# of new job offers when the job exchange gets updated
|
||||
int_job_new_offers_lower 3
|
||||
int_job_new_offers_upper 6
|
||||
|
||||
# how often (in weeks) an update occurs
|
||||
int_job_update_interval 5
|
||||
|
||||
# percentage of international offers
|
||||
float_job_international_perc 50000
|
||||
|
||||
# number of success points per average skill
|
||||
# difference unit (needed when finding out whether
|
||||
# a user's application for a job is successful)
|
||||
int_job_application_points_per_av_skill 40
|
||||
|
||||
# how many points a league layer difference is worth
|
||||
int_job_application_points_per_layer 30
|
||||
|
||||
# how many points more are needed for an international
|
||||
# application
|
||||
int_job_application_points_international 150
|
||||
|
||||
# how many points a country rating difference is worth
|
||||
int_job_application_points_per_rating 80
|
||||
|
|
Loading…
Reference in New Issue