mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-02-21 22:07:39 +01:00
Player contract warning, week fixtures.
This commit is contained in:
parent
81a1d1769c
commit
844694d652
@ -64,7 +64,7 @@
|
||||
<accelerator key="l" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image285">
|
||||
<widget class="GtkImage" id="image289">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -132,7 +132,7 @@
|
||||
<accelerator key="p" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image286">
|
||||
<widget class="GtkImage" id="image290">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -194,10 +194,20 @@
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu_figures_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menu_fixtures_week">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Fixtures (week)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_menu_fixtures_week_activate" last_modification_time="Fri, 15 Apr 2005 06:37:48 GMT"/>
|
||||
<accelerator key="F3" modifiers="0" signal="activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menu_fixtures">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">My fixtures</property>
|
||||
<property name="label" translatable="yes">Fixtures (competitions)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_menu_fixtures_activate" last_modification_time="Sun, 02 Jan 2005 15:38:39 GMT"/>
|
||||
<accelerator key="F4" modifiers="0" signal="activate"/>
|
||||
@ -268,7 +278,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">All Out Defend</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:56 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -278,7 +288,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Defend</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:07 GMT"/>
|
||||
</widget>
|
||||
@ -289,7 +299,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Balanced</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:14 GMT"/>
|
||||
</widget>
|
||||
@ -300,7 +310,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Attack</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_all_out_defend</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:20 GMT"/>
|
||||
</widget>
|
||||
@ -335,7 +345,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Best</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:47 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -345,7 +355,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Good</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_scout_best</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:35 GMT"/>
|
||||
</widget>
|
||||
@ -356,7 +366,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Average</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_scout_best</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:54 GMT"/>
|
||||
</widget>
|
||||
@ -391,7 +401,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Best</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:14 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -401,7 +411,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Good</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_physio_best</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:21 GMT"/>
|
||||
</widget>
|
||||
@ -412,7 +422,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Average</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_physio_best</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:28 GMT"/>
|
||||
</widget>
|
||||
@ -447,7 +457,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">On</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Tue, 08 Mar 2005 16:37:57 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -457,7 +467,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Off</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="active">True</property>
|
||||
<property name="group">menu_boost_on</property>
|
||||
<signal name="button_press_event" handler="on_menu_team_button_press_event" last_modification_time="Tue, 08 Mar 2005 16:37:48 GMT"/>
|
||||
</widget>
|
||||
@ -648,7 +658,7 @@
|
||||
<accelerator key="F9" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image287">
|
||||
<widget class="GtkImage" id="image291">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-go-forward</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -670,7 +680,7 @@
|
||||
<accelerator key="F8" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image288">
|
||||
<widget class="GtkImage" id="image292">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-go-back</property>
|
||||
<property name="icon_size">1</property>
|
||||
@ -692,7 +702,7 @@
|
||||
<accelerator key="F12" modifiers="0" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image289">
|
||||
<widget class="GtkImage" id="image293">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-justify-fill</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -887,6 +887,106 @@
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEventBox" id="eventbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Set to 0 to switch off warning</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox10">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label37">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show warning if a player contract gets below </property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkSpinButton" id="spinbutton_contract">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="climb_rate">1</property>
|
||||
<property name="digits">0</property>
|
||||
<property name="numeric">True</property>
|
||||
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
|
||||
<property name="snap_to_ticks">False</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="adjustment">1 0 24 1 10 10</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label38">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"> months</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkbutton_show_all_leagues">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Whether in the weekly fixture view all leagues or only the user league is shown</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Show all leagues in the fixture view</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -20,7 +20,7 @@ bygfoot_SOURCES = \
|
||||
game_gui.c file.h callbacks.h file.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h treeview.h support.h team.h user.h variables.h window.h \
|
||||
gui.c gui.h misc.h support.h variables.h window.h \
|
||||
interface.c callbacks.h interface.h support.h \
|
||||
league.c cup.h league.h player.h table.h team.h variables.h \
|
||||
league.c cup.h league.h maths.h option.h player.h table.h team.h variables.h \
|
||||
live_game.c fixture.h free.h game.h game_gui.h live_game.h maths.h misc_callback_func.h option.h player.h support.h team.h treeview.h user.h variables.h window.h \
|
||||
load_save.c callbacks.h file.h game_gui.h gui.h load_save.h option.h support.h user.h variables.h xml_loadsave_misc.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_transfers.h xml_loadsave_users.h xml.h \
|
||||
main.c cup_struct.h misc_callbacks.h file.h free.h league_struct.h live_game.h main.h transfer_struct.h variables.h window.h \
|
||||
|
@ -426,3 +426,39 @@ callback_fire_player(gint idx)
|
||||
|
||||
window_show_yesno(buf);
|
||||
}
|
||||
|
||||
/** Show fixtures by week and round (as opposed to
|
||||
competition-wise).
|
||||
@param type Whether to show current, next or previous weeks. */
|
||||
void
|
||||
callback_show_fixtures_week(gint type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case SHOW_CURRENT:
|
||||
if(week == 1 && week_round == 1)
|
||||
{
|
||||
stat1 = week;
|
||||
stat2 = week_round;
|
||||
}
|
||||
else if(week_round == 1)
|
||||
{
|
||||
stat1 = week - 1;
|
||||
stat2 = fixture_get_last_week_round(week - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
stat1 = week;
|
||||
stat2 = week_round - 1;
|
||||
}
|
||||
break;
|
||||
case SHOW_NEXT:
|
||||
fixture_get_next_week(&stat1, &stat2);
|
||||
break;
|
||||
case SHOW_PREVIOUS:
|
||||
fixture_get_previous_week(&stat1, &stat2);
|
||||
break;
|
||||
}
|
||||
|
||||
treeview_show_fixtures_week(stat1, stat2);
|
||||
}
|
||||
|
@ -42,4 +42,7 @@ callback_fire_player(gint idx);
|
||||
void
|
||||
callback_show_last_match_stats(void);
|
||||
|
||||
void
|
||||
callback_show_fixtures_week(gint type);
|
||||
|
||||
#endif
|
||||
|
@ -202,6 +202,9 @@ on_button_browse_forward_clicked (GtkButton *button,
|
||||
case STATUS_SHOW_FIXTURES:
|
||||
callback_show_fixtures(SHOW_NEXT);
|
||||
break;
|
||||
case STATUS_SHOW_FIXTURES_WEEK:
|
||||
callback_show_fixtures_week(SHOW_NEXT);
|
||||
break;
|
||||
case STATUS_BROWSE_TEAMS:
|
||||
callback_show_team(SHOW_NEXT);
|
||||
break;
|
||||
@ -222,6 +225,9 @@ on_button_browse_back_clicked (GtkButton *button,
|
||||
case STATUS_SHOW_FIXTURES:
|
||||
callback_show_fixtures(SHOW_PREVIOUS);
|
||||
break;
|
||||
case STATUS_SHOW_FIXTURES_WEEK:
|
||||
callback_show_fixtures_week(SHOW_PREVIOUS);
|
||||
break;
|
||||
case STATUS_BROWSE_TEAMS:
|
||||
callback_show_team(SHOW_PREVIOUS);
|
||||
break;
|
||||
@ -293,6 +299,17 @@ on_menu_fixtures_activate (GtkMenuItem *menuitem,
|
||||
gui_set_arrows();
|
||||
}
|
||||
|
||||
void
|
||||
on_menu_fixtures_week_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
stat0 = STATUS_SHOW_FIXTURES_WEEK;
|
||||
callback_show_fixtures_week(SHOW_CURRENT);
|
||||
|
||||
gui_set_arrows();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_menu_tables_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
|
@ -241,3 +241,7 @@ on_menu_rearrange_team_activate (GtkMenuItem *menuitem,
|
||||
void
|
||||
on_menu_load_last_save_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_menu_fixtures_week_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data);
|
||||
|
@ -70,6 +70,7 @@ enum Status0Value
|
||||
STATUS_SHOW_LAST_MATCH,
|
||||
STATUS_SHOW_LAST_MATCH_STATS,
|
||||
STATUS_SHOW_FIXTURES,
|
||||
STATUS_SHOW_FIXTURES_WEEK,
|
||||
STATUS_SHOW_TABLES,
|
||||
STATUS_SHOW_FINANCES,
|
||||
STATUS_SHOW_TRANSFER_LIST,
|
||||
|
118
src/fixture.c
118
src/fixture.c
@ -682,7 +682,7 @@ fixture_get_first_leg(const Fixture *fix)
|
||||
@param week_number The week number of the fixtures.
|
||||
@param week_round_number The week round of the fixtures. */
|
||||
GPtrArray*
|
||||
fixture_get_week_round_list(gint clid, gint week_number, gint week_round_number)
|
||||
fixture_get_week_list_clid(gint clid, gint week_number, gint week_round_number)
|
||||
{
|
||||
gint i;
|
||||
GArray *fixtures = league_cup_get_fixtures(clid);
|
||||
@ -696,6 +696,28 @@ fixture_get_week_round_list(gint clid, gint week_number, gint week_round_number)
|
||||
return fixtures_array;
|
||||
}
|
||||
|
||||
/** Return an array with all fixtures in a given week. */
|
||||
GPtrArray*
|
||||
fixture_get_week_list(gint week_number, gint week_round_number)
|
||||
{
|
||||
gint i, j;
|
||||
GPtrArray *fixtures = g_ptr_array_new();
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
for(j=0;j<lig(i).fixtures->len;j++)
|
||||
if(g_array_index(lig(i).fixtures, Fixture, j).week_number == week_number &&
|
||||
g_array_index(lig(i).fixtures, Fixture, j).week_round_number == week_round_number)
|
||||
g_ptr_array_add(fixtures, &g_array_index(lig(i).fixtures, Fixture, j));
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
if(g_array_index(acp(i)->fixtures, Fixture, j).week_number == week_number &&
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).week_round_number == week_round_number)
|
||||
g_ptr_array_add(fixtures, &g_array_index(acp(i)->fixtures, Fixture, j));
|
||||
|
||||
return fixtures;
|
||||
}
|
||||
|
||||
/** Print the result of the fixture into a buffer. */
|
||||
void
|
||||
fixture_result_to_buf(const Fixture *fix, gchar *buf)
|
||||
@ -1039,16 +1061,100 @@ fixture_sort_teams_bye(GPtrArray *teams, gint bye_len)
|
||||
|
||||
/** Return the last week round number of the specified week. */
|
||||
gint
|
||||
fixture_last_week_round(gint week_number)
|
||||
fixture_get_last_week_round(gint week_number)
|
||||
{
|
||||
gint i, j;
|
||||
gint week_round_number = 1;
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
for(j=0;j<cp(i).fixtures->len;j++)
|
||||
if(g_array_index(cp(i).fixtures, Fixture, j).week_number == week_number)
|
||||
for(i=0;i<acps->len;i++)
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
if(g_array_index(acp(i)->fixtures, Fixture, j).week_number == week_number)
|
||||
week_round_number = MAX(week_round_number,
|
||||
g_array_index(cp(i).fixtures, Fixture, j).week_round_number);
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).week_round_number);
|
||||
|
||||
return week_round_number;
|
||||
}
|
||||
|
||||
/** Get the next week and round there are fixtures from
|
||||
the specified ones onwards and write it into the variables. */
|
||||
void
|
||||
fixture_get_next_week(gint *week_number, gint *week_round_number)
|
||||
{
|
||||
gint i;
|
||||
gint local_week = *week_number,
|
||||
local_round = *week_round_number;
|
||||
Fixture *fix = NULL;
|
||||
|
||||
*week_number = *week_round_number = 1000;
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
{
|
||||
fix = fixture_get_next(lig(i).id, local_week, local_round);
|
||||
if(fix->week_number > local_week && fix->week_number < *week_number)
|
||||
{
|
||||
*week_number = fix->week_number;
|
||||
*week_round_number = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
{
|
||||
fix = fixture_get_next(acp(i)->id, local_week, local_round);
|
||||
if((fix->week_number > local_week ||
|
||||
(fix->week_number == local_week && fix->week_round_number > local_round)) &&
|
||||
(fix->week_number < *week_number ||
|
||||
(fix->week_number == *week_number && fix->week_round_number < *week_round_number)))
|
||||
{
|
||||
*week_number = fix->week_number;
|
||||
*week_round_number = fix->week_round_number;
|
||||
}
|
||||
}
|
||||
|
||||
if(*week_number == 1000)
|
||||
*week_number = *week_round_number = 1;
|
||||
}
|
||||
|
||||
/** Get the previous week and round there are fixtures
|
||||
and write it into the variables. */
|
||||
void
|
||||
fixture_get_previous_week(gint *week_number, gint *week_round_number)
|
||||
{
|
||||
gint i;
|
||||
gint local_week = *week_number,
|
||||
local_round = *week_round_number;
|
||||
Fixture *fix = NULL;
|
||||
|
||||
*week_number = *week_round_number = -1;
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
{
|
||||
fix = fixture_get_previous(lig(i).id, local_week, local_round);
|
||||
if((fix->week_number < local_week ||
|
||||
(fix->week_number == local_week && fix->week_round_number < local_round)) &&
|
||||
(fix->week_number > *week_number ||
|
||||
(fix->week_number == *week_number && fix->week_round_number > *week_round_number)))
|
||||
{
|
||||
*week_number = fix->week_number;
|
||||
*week_round_number = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
{
|
||||
fix = fixture_get_previous(acp(i)->id, local_week, local_round);
|
||||
if((fix->week_number < local_week ||
|
||||
(fix->week_number == local_week && fix->week_round_number < local_round)) &&
|
||||
(fix->week_number > *week_number ||
|
||||
(fix->week_number == *week_number && fix->week_round_number > *week_round_number)))
|
||||
{
|
||||
*week_number = fix->week_number;
|
||||
*week_round_number = fix->week_round_number;
|
||||
}
|
||||
}
|
||||
|
||||
if(*week_number == -1)
|
||||
{
|
||||
*week_number = local_week;
|
||||
*week_round_number = local_round;
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ Fixture*
|
||||
fixture_get_first_leg(const Fixture *fix);
|
||||
|
||||
GPtrArray*
|
||||
fixture_get_week_round_list(gint clid, gint week_number, gint week_round_number);
|
||||
fixture_get_week_list_clid(gint clid, gint week_number, gint week_round_number);
|
||||
|
||||
void
|
||||
fixture_result_to_buf(const Fixture *fix, gchar *buf);
|
||||
@ -119,6 +119,15 @@ void
|
||||
fixture_sort_teams_bye(GPtrArray *teams, gint bye_len);
|
||||
|
||||
gint
|
||||
fixture_last_week_round(gint week_number);
|
||||
fixture_get_last_week_round(gint week_number);
|
||||
|
||||
void
|
||||
fixture_get_next_week(gint *week_number, gint *week_round_number);
|
||||
|
||||
void
|
||||
fixture_get_previous_week(gint *week_number, gint *week_round_number);
|
||||
|
||||
GPtrArray*
|
||||
fixture_get_week_list(gint week_number, gint week_round_number);
|
||||
|
||||
#endif
|
||||
|
@ -116,7 +116,8 @@ gui_set_arrows(void)
|
||||
if(stat0 == STATUS_SHOW_FIXTURES ||
|
||||
stat0 == STATUS_BROWSE_TEAMS)
|
||||
gui_set_arrow_pair(3, TRUE);
|
||||
else if(stat0 == STATUS_SHOW_PLAYER_INFO)
|
||||
else if(stat0 == STATUS_SHOW_PLAYER_INFO ||
|
||||
stat0 == STATUS_SHOW_FIXTURES_WEEK)
|
||||
gui_set_arrow_pair(1, TRUE);
|
||||
else if(stat0 == STATUS_SHOW_TABLES ||
|
||||
stat0 == STATUS_SHOW_PLAYER_LIST)
|
||||
|
@ -38,7 +38,7 @@ create_main_window (void)
|
||||
GtkWidget *menu_new;
|
||||
GtkWidget *menu_open;
|
||||
GtkWidget *menu_load_last_save;
|
||||
GtkWidget *image285;
|
||||
GtkWidget *image289;
|
||||
GtkWidget *menu_save;
|
||||
GtkWidget *menu_save_as;
|
||||
GtkWidget *trennlinie1;
|
||||
@ -46,13 +46,14 @@ create_main_window (void)
|
||||
GtkWidget *menu_options;
|
||||
GtkWidget *menu_options_menu;
|
||||
GtkWidget *menu_preferences;
|
||||
GtkWidget *image286;
|
||||
GtkWidget *image290;
|
||||
GtkWidget *trennlinie7;
|
||||
GtkWidget *menu_job_offers;
|
||||
GtkWidget *menu_live_game;
|
||||
GtkWidget *menu_overwrite;
|
||||
GtkWidget *menu_figures;
|
||||
GtkWidget *menu_figures_menu;
|
||||
GtkWidget *menu_fixtures_week;
|
||||
GtkWidget *menu_fixtures;
|
||||
GtkWidget *menu_tables;
|
||||
GtkWidget *menu_my_league_results;
|
||||
@ -109,11 +110,11 @@ create_main_window (void)
|
||||
GtkWidget *menu_user_show_last_stats;
|
||||
GtkWidget *trennlinie9;
|
||||
GtkWidget *menu_next_user;
|
||||
GtkWidget *image287;
|
||||
GtkWidget *image291;
|
||||
GtkWidget *menu_previous_user;
|
||||
GtkWidget *image288;
|
||||
GtkWidget *image292;
|
||||
GtkWidget *menu_manage_users;
|
||||
GtkWidget *image289;
|
||||
GtkWidget *image293;
|
||||
GtkWidget *menu_finances_stadium;
|
||||
GtkWidget *menu_finances_stadium_menu;
|
||||
GtkWidget *menu_show_finances;
|
||||
@ -243,9 +244,9 @@ create_main_window (void)
|
||||
GDK_l, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image285 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image285);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_load_last_save), image285);
|
||||
image289 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image289);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_load_last_save), image289);
|
||||
|
||||
menu_save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group);
|
||||
gtk_widget_show (menu_save);
|
||||
@ -278,9 +279,9 @@ create_main_window (void)
|
||||
GDK_p, GDK_CONTROL_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image286 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image286);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image286);
|
||||
image290 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image290);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image290);
|
||||
|
||||
trennlinie7 = gtk_menu_item_new ();
|
||||
gtk_widget_show (trennlinie7);
|
||||
@ -308,7 +309,14 @@ create_main_window (void)
|
||||
menu_figures_menu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_figures), menu_figures_menu);
|
||||
|
||||
menu_fixtures = gtk_menu_item_new_with_mnemonic (_("My fixtures"));
|
||||
menu_fixtures_week = gtk_menu_item_new_with_mnemonic (_("Fixtures (week)"));
|
||||
gtk_widget_show (menu_fixtures_week);
|
||||
gtk_container_add (GTK_CONTAINER (menu_figures_menu), menu_fixtures_week);
|
||||
gtk_widget_add_accelerator (menu_fixtures_week, "activate", accel_group,
|
||||
GDK_F3, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
menu_fixtures = gtk_menu_item_new_with_mnemonic (_("Fixtures (competitions)"));
|
||||
gtk_widget_show (menu_fixtures);
|
||||
gtk_container_add (GTK_CONTAINER (menu_figures_menu), menu_fixtures);
|
||||
gtk_widget_add_accelerator (menu_fixtures, "activate", accel_group,
|
||||
@ -352,21 +360,25 @@ create_main_window (void)
|
||||
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_defend));
|
||||
gtk_widget_show (menu_all_out_defend);
|
||||
gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_all_out_defend);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_all_out_defend), TRUE);
|
||||
|
||||
menu_defend = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Defend"));
|
||||
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_defend));
|
||||
gtk_widget_show (menu_defend);
|
||||
gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_defend);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_defend), TRUE);
|
||||
|
||||
menu_balanced = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Balanced"));
|
||||
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_balanced));
|
||||
gtk_widget_show (menu_balanced);
|
||||
gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_balanced);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_balanced), TRUE);
|
||||
|
||||
menu_attack = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Attack"));
|
||||
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_attack));
|
||||
gtk_widget_show (menu_attack);
|
||||
gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_attack);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_attack), TRUE);
|
||||
|
||||
menu_all_out_attack = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("All Out Attack"));
|
||||
menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_attack));
|
||||
@ -385,16 +397,19 @@ create_main_window (void)
|
||||
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_best));
|
||||
gtk_widget_show (menu_scout_best);
|
||||
gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_best);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_best), TRUE);
|
||||
|
||||
menu_scout_good = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Good"));
|
||||
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_good));
|
||||
gtk_widget_show (menu_scout_good);
|
||||
gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_good);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_good), TRUE);
|
||||
|
||||
menu_scout_average = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Average"));
|
||||
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_average));
|
||||
gtk_widget_show (menu_scout_average);
|
||||
gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_average);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_average), TRUE);
|
||||
|
||||
menu_scout_bad = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Bad"));
|
||||
menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_bad));
|
||||
@ -413,16 +428,19 @@ create_main_window (void)
|
||||
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_best));
|
||||
gtk_widget_show (menu_physio_best);
|
||||
gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_best);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_best), TRUE);
|
||||
|
||||
menu_physio_good = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Good"));
|
||||
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_good));
|
||||
gtk_widget_show (menu_physio_good);
|
||||
gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_good);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_good), TRUE);
|
||||
|
||||
menu_physio_average = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Average"));
|
||||
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_average));
|
||||
gtk_widget_show (menu_physio_average);
|
||||
gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_average);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_average), TRUE);
|
||||
|
||||
menu_physio_bad = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Bad"));
|
||||
menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_bad));
|
||||
@ -441,11 +459,13 @@ create_main_window (void)
|
||||
menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_on));
|
||||
gtk_widget_show (menu_boost_on);
|
||||
gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_on);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_boost_on), TRUE);
|
||||
|
||||
menu_boost_off = gtk_radio_menu_item_new_with_mnemonic (menu_boost_on_group, _("Off"));
|
||||
menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_off));
|
||||
gtk_widget_show (menu_boost_off);
|
||||
gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_off);
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_boost_off), TRUE);
|
||||
|
||||
menu_boost_anti = gtk_radio_menu_item_new_with_mnemonic (menu_boost_on_group, _("Anti"));
|
||||
menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_anti));
|
||||
@ -549,9 +569,9 @@ create_main_window (void)
|
||||
GDK_F9, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image287 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image287);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image287);
|
||||
image291 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image291);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image291);
|
||||
|
||||
menu_previous_user = gtk_image_menu_item_new_with_mnemonic (_("Previous user"));
|
||||
gtk_widget_show (menu_previous_user);
|
||||
@ -560,9 +580,9 @@ create_main_window (void)
|
||||
GDK_F8, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image288 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image288);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image288);
|
||||
image292 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image292);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image292);
|
||||
|
||||
menu_manage_users = gtk_image_menu_item_new_with_mnemonic (_("Manage users"));
|
||||
gtk_widget_show (menu_manage_users);
|
||||
@ -571,9 +591,9 @@ create_main_window (void)
|
||||
GDK_F12, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
image289 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image289);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image289);
|
||||
image293 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
|
||||
gtk_widget_show (image293);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image293);
|
||||
|
||||
menu_finances_stadium = gtk_menu_item_new_with_mnemonic (_("FinStad"));
|
||||
gtk_widget_show (menu_finances_stadium);
|
||||
@ -1032,6 +1052,9 @@ create_main_window (void)
|
||||
g_signal_connect ((gpointer) menu_overwrite, "button_press_event",
|
||||
G_CALLBACK (on_menu_check_button_press_event),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) menu_fixtures_week, "activate",
|
||||
G_CALLBACK (on_menu_fixtures_week_activate),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) menu_fixtures, "activate",
|
||||
G_CALLBACK (on_menu_fixtures_activate),
|
||||
NULL);
|
||||
@ -1210,7 +1233,7 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_new, "menu_new");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_open, "menu_open");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_load_last_save, "menu_load_last_save");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image285, "image285");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image289, "image289");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_save, "menu_save");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_save_as, "menu_save_as");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie1, "trennlinie1");
|
||||
@ -1218,13 +1241,14 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_options, "menu_options");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_options_menu, "menu_options_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_preferences, "menu_preferences");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image286, "image286");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image290, "image290");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie7, "trennlinie7");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_job_offers, "menu_job_offers");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_live_game, "menu_live_game");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_overwrite, "menu_overwrite");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_figures, "menu_figures");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_figures_menu, "menu_figures_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_fixtures_week, "menu_fixtures_week");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_fixtures, "menu_fixtures");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_tables, "menu_tables");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_my_league_results, "menu_my_league_results");
|
||||
@ -1277,11 +1301,11 @@ create_main_window (void)
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_user_show_last_stats, "menu_user_show_last_stats");
|
||||
GLADE_HOOKUP_OBJECT (main_window, trennlinie9, "trennlinie9");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_next_user, "menu_next_user");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image287, "image287");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image291, "image291");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_previous_user, "menu_previous_user");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image288, "image288");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image292, "image292");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_manage_users, "menu_manage_users");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image289, "image289");
|
||||
GLADE_HOOKUP_OBJECT (main_window, image293, "image293");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium, "menu_finances_stadium");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium_menu, "menu_finances_stadium_menu");
|
||||
GLADE_HOOKUP_OBJECT (main_window, menu_show_finances, "menu_show_finances");
|
||||
|
36
src/league.c
36
src/league.c
@ -1,5 +1,7 @@
|
||||
#include "cup.h"
|
||||
#include "league.h"
|
||||
#include "maths.h"
|
||||
#include "option.h"
|
||||
#include "player.h"
|
||||
#include "table.h"
|
||||
#include "team.h"
|
||||
@ -367,6 +369,11 @@ void
|
||||
league_season_start(League *league)
|
||||
{
|
||||
gint i, j;
|
||||
gint idx = league_index_from_sid(league->sid->str);
|
||||
gboolean user_champ =
|
||||
(team_is_user(
|
||||
team_of_id(g_array_index(lig(0).table.elements, TableElement, 0).team_id)) != -1);
|
||||
gfloat team_change_factor = 0;
|
||||
|
||||
for(i=0;i<league->table.elements->len;i++)
|
||||
{
|
||||
@ -381,8 +388,21 @@ league_season_start(League *league)
|
||||
|
||||
/*todo: make teams better if user champion?*/
|
||||
for(i=0;i<league->teams->len;i++)
|
||||
{
|
||||
team_change_factor =
|
||||
(team_is_user(&g_array_index(league->teams, Team, i)) == -1) *
|
||||
math_rnd(const_float("float_season_end_team_change_lower") +
|
||||
(user_champ && idx == 0) * const_float("float_season_end_user_champ_addition"),
|
||||
const_float("float_season_end_team_change_upper") +
|
||||
(user_champ && idx == 0) * const_float("float_season_end_user_champ_addition"));
|
||||
|
||||
for(j=0;j<g_array_index(league->teams, Team, i).players->len;j++)
|
||||
player_season_start(&g_array_index(g_array_index(league->teams, Team, i).players, Player, j));
|
||||
player_season_start(
|
||||
&g_array_index(g_array_index(league->teams, Team, i).players, Player, j), team_change_factor);
|
||||
|
||||
if(team_is_user(&g_array_index(league->teams, Team, i)) == -1)
|
||||
team_update_cpu_structure(&g_array_index(league->teams, Team, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -393,25 +413,11 @@ query_league_rank_in_prom_games(const League *league, gint rank)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
/*d*/
|
||||
/* for(i=0;i<ligs->len;i++) */
|
||||
/* printf("%d les %s lig %s sid %s id %d rank %d\n", i, */
|
||||
/* lig(i).name->str, league->sid->str, */
|
||||
/* lig(i).sid->str, lig(i).id, rank);getchar(); */
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(league_has_prom_games((&lig(i))))
|
||||
{
|
||||
/* printf("dest %s nam %s ctlen %d\n", */
|
||||
/* lig(i).prom_rel.prom_games_dest_sid->str, */
|
||||
/* lig(i).prom_rel.prom_games_cup.name->str, */
|
||||
/* lig(i).prom_rel.prom_games_cup.choose_teams->len);getchar(); */
|
||||
|
||||
for(j=0;j<lig(i).prom_rel.prom_games_cup.choose_teams->len;j++)
|
||||
{
|
||||
/* printf("fo %s %s\n", */
|
||||
/* g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams, CupChooseTeam, j).sid->str, */
|
||||
/* league->sid->str); */
|
||||
if(strcmp(g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams, CupChooseTeam, j).sid->str,
|
||||
league->sid->str) == 0 &&
|
||||
((rank >= g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams,
|
||||
|
@ -26,6 +26,7 @@ enum BooleanOptions
|
||||
BOOL_OPT_SHOW_JOB,
|
||||
BOOL_OPT_SWAP,
|
||||
BOOL_OPT_SHOW_OVERALL,
|
||||
BOOL_OPT_SHOW_ALL_LEAGUES,
|
||||
BOOL_OPT_PL1_ATT_NAME,
|
||||
BOOL_OPT_PL1_ATT_CPOS,
|
||||
BOOL_OPT_PL1_ATT_POS,
|
||||
@ -130,6 +131,10 @@ option_gui_write_bool_widgets(gint **bool_options, GtkToggleButton **bool_widget
|
||||
GTK_TOGGLE_BUTTON(lookup_widget(window.options, "checkbutton_show_overall"));
|
||||
bool_options[BOOL_OPT_SHOW_OVERALL] = opt_user_intp("int_opt_user_show_overall");
|
||||
|
||||
bool_widgets[BOOL_OPT_SHOW_ALL_LEAGUES] =
|
||||
GTK_TOGGLE_BUTTON(lookup_widget(window.options, "checkbutton_show_all_leagues"));
|
||||
bool_options[BOOL_OPT_SHOW_ALL_LEAGUES] = opt_user_intp("int_opt_user_show_all_leagues");
|
||||
|
||||
bool_widgets[BOOL_OPT_PL1_ATT_NAME] =
|
||||
GTK_TOGGLE_BUTTON(lookup_widget(window.options, "checkbutton1"));
|
||||
bool_options[BOOL_OPT_PL1_ATT_NAME] = opt_user_intp("int_opt_user_pl1_att_name");
|
||||
@ -283,6 +288,7 @@ enum SpinOptions
|
||||
SPIN_OPT_PRECISION,
|
||||
SPIN_OPT_REFRESH,
|
||||
SPIN_OPT_LIVE_SPEED,
|
||||
SPIN_OPT_CONTRACT,
|
||||
SPIN_OPT_END
|
||||
};
|
||||
|
||||
@ -309,6 +315,10 @@ option_gui_write_spin_widgets(gint **spin_options, GtkSpinButton **spin_widgets)
|
||||
spin_widgets[SPIN_OPT_LIVE_SPEED] =
|
||||
GTK_SPIN_BUTTON(lookup_widget(window.options, "spinbutton_live_speed"));
|
||||
spin_options[SPIN_OPT_LIVE_SPEED] = opt_user_intp("int_opt_user_live_game_speed");
|
||||
|
||||
spin_widgets[SPIN_OPT_CONTRACT] =
|
||||
GTK_SPIN_BUTTON(lookup_widget(window.options, "spinbutton_contract"));
|
||||
spin_options[SPIN_OPT_CONTRACT] = opt_user_intp("int_opt_user_contract_limit");
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,6 +88,13 @@ create_window_options (void)
|
||||
GtkWidget *hbox6;
|
||||
GtkWidget *vbox6;
|
||||
GtkWidget *checkbutton_show_job;
|
||||
GtkWidget *eventbox1;
|
||||
GtkWidget *hbox10;
|
||||
GtkWidget *label37;
|
||||
GtkObject *spinbutton_contract_adj;
|
||||
GtkWidget *spinbutton_contract;
|
||||
GtkWidget *label38;
|
||||
GtkWidget *checkbutton_show_all_leagues;
|
||||
GtkWidget *vseparator3;
|
||||
GtkWidget *vbox7;
|
||||
GtkWidget *checkbutton_swap_adapts;
|
||||
@ -438,6 +445,36 @@ create_window_options (void)
|
||||
gtk_widget_show (checkbutton_show_job);
|
||||
gtk_box_pack_start (GTK_BOX (vbox6), checkbutton_show_job, FALSE, FALSE, 0);
|
||||
|
||||
eventbox1 = gtk_event_box_new ();
|
||||
gtk_widget_show (eventbox1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox6), eventbox1, FALSE, FALSE, 0);
|
||||
gtk_tooltips_set_tip (tooltips, eventbox1, _("Set to 0 to switch off warning"), NULL);
|
||||
|
||||
hbox10 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox10);
|
||||
gtk_container_add (GTK_CONTAINER (eventbox1), hbox10);
|
||||
|
||||
label37 = gtk_label_new (_("Show warning if a player contract gets below "));
|
||||
gtk_widget_show (label37);
|
||||
gtk_box_pack_start (GTK_BOX (hbox10), label37, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label37), GTK_JUSTIFY_LEFT);
|
||||
|
||||
spinbutton_contract_adj = gtk_adjustment_new (1, 0, 24, 1, 10, 10);
|
||||
spinbutton_contract = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_contract_adj), 1, 0);
|
||||
gtk_widget_show (spinbutton_contract);
|
||||
gtk_box_pack_start (GTK_BOX (hbox10), spinbutton_contract, FALSE, FALSE, 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton_contract), TRUE);
|
||||
|
||||
label38 = gtk_label_new (_(" months"));
|
||||
gtk_widget_show (label38);
|
||||
gtk_box_pack_start (GTK_BOX (hbox10), label38, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label38), GTK_JUSTIFY_LEFT);
|
||||
|
||||
checkbutton_show_all_leagues = gtk_check_button_new_with_mnemonic (_("Show all leagues in the fixture view"));
|
||||
gtk_widget_show (checkbutton_show_all_leagues);
|
||||
gtk_box_pack_start (GTK_BOX (vbox6), checkbutton_show_all_leagues, FALSE, FALSE, 0);
|
||||
gtk_tooltips_set_tip (tooltips, checkbutton_show_all_leagues, _("Whether in the weekly fixture view all leagues or only the user league is shown"), NULL);
|
||||
|
||||
vseparator3 = gtk_vseparator_new ();
|
||||
gtk_widget_show (vseparator3);
|
||||
gtk_box_pack_start (GTK_BOX (hbox6), vseparator3, FALSE, FALSE, 0);
|
||||
@ -981,6 +1018,12 @@ create_window_options (void)
|
||||
GLADE_HOOKUP_OBJECT (window_options, hbox6, "hbox6");
|
||||
GLADE_HOOKUP_OBJECT (window_options, vbox6, "vbox6");
|
||||
GLADE_HOOKUP_OBJECT (window_options, checkbutton_show_job, "checkbutton_show_job");
|
||||
GLADE_HOOKUP_OBJECT (window_options, eventbox1, "eventbox1");
|
||||
GLADE_HOOKUP_OBJECT (window_options, hbox10, "hbox10");
|
||||
GLADE_HOOKUP_OBJECT (window_options, label37, "label37");
|
||||
GLADE_HOOKUP_OBJECT (window_options, spinbutton_contract, "spinbutton_contract");
|
||||
GLADE_HOOKUP_OBJECT (window_options, label38, "label38");
|
||||
GLADE_HOOKUP_OBJECT (window_options, checkbutton_show_all_leagues, "checkbutton_show_all_leagues");
|
||||
GLADE_HOOKUP_OBJECT (window_options, vseparator3, "vseparator3");
|
||||
GLADE_HOOKUP_OBJECT (window_options, vbox7, "vbox7");
|
||||
GLADE_HOOKUP_OBJECT (window_options, checkbutton_swap_adapts, "checkbutton_swap_adapts");
|
||||
|
36
src/player.c
36
src/player.c
@ -920,6 +920,7 @@ player_update_injury(Player *pl)
|
||||
void
|
||||
player_update_weekly(Team *tm, gint idx)
|
||||
{
|
||||
gchar buf[SMALL];
|
||||
Player *pl = player_of_idx_team(tm, idx);
|
||||
|
||||
if(debug < 50)
|
||||
@ -928,7 +929,16 @@ player_update_weekly(Team *tm, gint idx)
|
||||
pl->contract -= 0.0192;
|
||||
}
|
||||
|
||||
/*todo: warning*/
|
||||
if(pl->contract * 12 <= opt_user_int("int_opt_user_contract_limit") &&
|
||||
(pl->contract + 0.0192) * 12 > opt_user_int("int_opt_user_contract_limit"))
|
||||
{
|
||||
sprintf(buf, _("%s's contract expires in %.1f years."),
|
||||
pl->name->str, pl->contract);
|
||||
|
||||
user_event_add(&usr(team_is_user(tm)), EVENT_TYPE_WARNING,
|
||||
-1, -1, NULL, buf);
|
||||
}
|
||||
|
||||
if(pl->contract <= 0)
|
||||
player_remove_contract(tm, idx);
|
||||
|
||||
@ -1068,10 +1078,14 @@ player_injury_to_char(gint injury_type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Nullify some stuff at the beginning of the season. */
|
||||
/** Nullify some stuff at the beginning of the season and change the skills
|
||||
of cpu players.
|
||||
@param skill_change Skill change of the player in percentage. */
|
||||
void
|
||||
player_season_start(Player *pl)
|
||||
player_season_start(Player *pl, gfloat skill_change)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if(pl->games_goals->len > 0)
|
||||
{
|
||||
g_array_free(pl->games_goals, TRUE);
|
||||
@ -1083,4 +1097,20 @@ player_season_start(Player *pl)
|
||||
g_array_free(pl->cards, TRUE);
|
||||
pl->cards = g_array_new(FALSE, FALSE, sizeof(PlayerGamesGoals));
|
||||
}
|
||||
|
||||
if(skill_change != 0)
|
||||
{
|
||||
pl->skill *= (1 + skill_change);
|
||||
|
||||
pl->skill = CLAMP(pl->skill, 0, pl->talent);
|
||||
pl->cskill = player_get_cskill(pl, pl->cpos);
|
||||
pl->value = player_assign_value(pl);
|
||||
|
||||
for(i=0;i<QUALITY_END;i++)
|
||||
if(pl->skill > pl->etal[i])
|
||||
{
|
||||
player_estimate_talent(pl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,6 +134,6 @@ Team*
|
||||
player_id_team(gint player_id);
|
||||
|
||||
void
|
||||
player_season_start(Player *pl);
|
||||
player_season_start(Player *pl, gfloat skill_change);
|
||||
|
||||
#endif
|
||||
|
@ -65,16 +65,22 @@ start_new_season(void)
|
||||
|
||||
/*todo: nullify, promotion/relegation*/
|
||||
if(season > 1)
|
||||
{
|
||||
start_new_season_team_movements();
|
||||
|
||||
start_load_cup_teams();
|
||||
for(i=0;i<users->len;i++)
|
||||
usr(i).tm = team_of_id(usr(i).team_id);
|
||||
}
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
{
|
||||
league_season_start(&lig(i));
|
||||
if(season > 1)
|
||||
league_season_start(&lig(i));
|
||||
fixture_write_league_fixtures(&lig(i));
|
||||
}
|
||||
|
||||
start_load_cup_teams();
|
||||
|
||||
for(i=acps->len - 1;i >= 0;i--)
|
||||
{
|
||||
if(acp(i)->id >= ID_PROM_CUP_START)
|
||||
@ -82,9 +88,6 @@ start_new_season(void)
|
||||
else
|
||||
fixture_write_cup_fixtures(&cp(i));
|
||||
}
|
||||
|
||||
for(i=0;i<users->len;i++)
|
||||
usr(i).tm = team_of_id(usr(i).team_id);
|
||||
}
|
||||
|
||||
/** Fill some global variables with default values at the
|
||||
@ -309,8 +312,10 @@ start_week_round(void)
|
||||
}
|
||||
|
||||
if(/*d*/FALSE && !query_user_games_this_week_round() &&
|
||||
((week_round == 1 && !query_user_games_in_week_round(week - 1, fixture_last_week_round(week - 1))) ||
|
||||
(week_round > 1 && !query_user_games_in_week_round(week, week_round - 1))))
|
||||
((week_round == 1 &&
|
||||
!query_user_games_in_week_round(week - 1, fixture_get_last_week_round(week - 1))) ||
|
||||
(week_round > 1 &&
|
||||
!query_user_games_in_week_round(week, week_round - 1))))
|
||||
end_week_round();
|
||||
else
|
||||
{
|
||||
|
@ -1287,7 +1287,7 @@ treeview_create_fixtures(gint clid, gint week_number, gint week_round_number)
|
||||
{
|
||||
gint i;
|
||||
GtkListStore *liststore;
|
||||
GPtrArray *fixtures = fixture_get_week_round_list(clid, week_number, week_round_number);
|
||||
GPtrArray *fixtures = fixture_get_week_list_clid(clid, week_number, week_round_number);
|
||||
|
||||
if(fixtures->len == 0)
|
||||
{
|
||||
@ -2330,3 +2330,57 @@ treeview_show_player_info(const Player *pl)
|
||||
gtk_tree_view_set_model(treeview, model);
|
||||
g_object_unref(model);
|
||||
}
|
||||
|
||||
|
||||
GtkTreeModel*
|
||||
treeview_create_fixtures_week(gint week_number, gint week_round_number)
|
||||
{
|
||||
gint i;
|
||||
GPtrArray *fixtures = fixture_get_week_list(week_number, week_round_number);
|
||||
GtkListStore *liststore = gtk_list_store_new(5,
|
||||
GDK_TYPE_PIXBUF,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
GDK_TYPE_PIXBUF);
|
||||
GtkTreeIter iter;
|
||||
|
||||
for(i=0;i<fixtures->len;i++)
|
||||
{
|
||||
if(((Fixture*)g_ptr_array_index(fixtures, i))->clid >= ID_CUP_START ||
|
||||
((Fixture*)g_ptr_array_index(fixtures, i))->clid == current_user.tm->clid ||
|
||||
opt_user_int("int_opt_user_show_all_leagues"))
|
||||
{
|
||||
if(i == 0 ||
|
||||
((Fixture*)g_ptr_array_index(fixtures, i))->clid !=
|
||||
((Fixture*)g_ptr_array_index(fixtures, i - 1))->clid)
|
||||
{
|
||||
gtk_list_store_append(liststore, &iter);
|
||||
gtk_list_store_set(liststore, &iter, 0, NULL, -1);
|
||||
treeview_create_fixtures_header((Fixture*)g_ptr_array_index(fixtures, i),
|
||||
liststore, TRUE);
|
||||
}
|
||||
|
||||
treeview_create_fixture((Fixture*)g_ptr_array_index(fixtures, i), liststore);
|
||||
}
|
||||
}
|
||||
|
||||
g_ptr_array_free(fixtures, TRUE);
|
||||
|
||||
return GTK_TREE_MODEL(liststore);
|
||||
}
|
||||
|
||||
/** Show a fixture list of all matches in the given week and round. */
|
||||
void
|
||||
treeview_show_fixtures_week(gint week_number, gint week_round_number)
|
||||
{
|
||||
GtkTreeView *treeview = GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right"));
|
||||
GtkTreeModel *model = NULL;
|
||||
|
||||
treeview_clear(treeview);
|
||||
|
||||
treeview_set_up_fixtures(treeview);
|
||||
model = treeview_create_fixtures_week(week_number, week_round_number);
|
||||
gtk_tree_view_set_model(treeview, model);
|
||||
g_object_unref(model);
|
||||
}
|
||||
|
@ -217,4 +217,13 @@ treeview_iter_get_row(GtkTreeModel *model, GtkTreeIter *iter);
|
||||
void
|
||||
treeview_create_stadium_summary(GtkListStore *liststore);
|
||||
|
||||
void
|
||||
treeview_show_fixtures_week(gint week_number, gint week_round_number);
|
||||
|
||||
void
|
||||
treeview_show_fixtures_week(gint week_number, gint week_round_number);
|
||||
|
||||
GtkTreeModel*
|
||||
treeview_create_fixtures_week(gint week_number, gint week_round_number);
|
||||
|
||||
#endif
|
||||
|
@ -14,7 +14,7 @@ int_opt_autosave_interval 5
|
||||
int_opt_autosave_files 5
|
||||
|
||||
# precision of skill and talent in player lists
|
||||
int_opt_player_precision 0
|
||||
int_opt_player_precision 2
|
||||
|
||||
# refresh rate of the player list during a live game
|
||||
# the smaller the more often the list gets refreshed
|
||||
|
@ -267,6 +267,15 @@ float_team_playing_structure_prob4 8500
|
||||
# @see player_generate()
|
||||
float_team_skill_variance 750
|
||||
|
||||
# maximum player skill changes in cpu teams at
|
||||
# the beginning of a new season in percent
|
||||
float_season_end_team_change_lower -400
|
||||
float_season_end_team_change_upper 400
|
||||
|
||||
# additional percentage if a user was first league
|
||||
# champion
|
||||
float_season_end_user_champ_addition 100
|
||||
|
||||
# bounds for new teams when user's been fired
|
||||
# counted in the tables relative to his team
|
||||
int_team_new_bound_upper 10
|
||||
|
@ -14,6 +14,8 @@ int_opt_user_auto_sub 1
|
||||
int_opt_user_show_job_offers 1
|
||||
int_opt_user_swap_adapts 1
|
||||
int_opt_user_show_overall 0
|
||||
int_opt_user_show_all_leagues 0
|
||||
int_opt_user_contract_limit 12
|
||||
|
||||
int_opt_user_penalty_shooter -1
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
</cup_round>
|
||||
<cup_round>
|
||||
<home_away>0</home_away>
|
||||
<neutral>1</neutral>
|
||||
</cup_round>
|
||||
</cup_rounds>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
</cup_round>
|
||||
<cup_round>
|
||||
<home_away>0</home_away>
|
||||
<neutral>1</neutral>
|
||||
</cup_round>
|
||||
</cup_rounds>
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
</cup_round>
|
||||
<cup_round>
|
||||
<home_away>0</home_away>
|
||||
<neutral>1</neutral>
|
||||
</cup_round>
|
||||
</cup_rounds>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user