Live game development.

This commit is contained in:
gyboth 2005-03-11 17:18:51 +00:00
parent e3ee5be2c7
commit f8e9156b5f
37 changed files with 469 additions and 97 deletions

View File

@ -98,7 +98,7 @@
<signal name="activate" handler="on_start_editor_activate" last_modification_time="Sun, 30 May 2004 19:58:16 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image194">
<widget class="GtkImage" id="image204">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -119,7 +119,7 @@
<signal name="activate" handler="on_start_update_activate" last_modification_time="Mon, 13 Sep 2004 12:30:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image195">
<widget class="GtkImage" id="image205">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -168,7 +168,7 @@
<signal name="activate" handler="on_menu_preferences_activate" last_modification_time="Sun, 02 Jan 2005 15:30:45 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image196">
<widget class="GtkImage" id="image206">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -312,7 +312,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:56 GMT"/>
</widget>
</child>
@ -322,7 +322,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:07 GMT"/>
</widget>
@ -333,7 +333,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:14 GMT"/>
</widget>
@ -344,7 +344,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:17:20 GMT"/>
</widget>
@ -379,7 +379,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:47 GMT"/>
</widget>
</child>
@ -389,7 +389,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:35 GMT"/>
</widget>
@ -400,7 +400,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:15:54 GMT"/>
</widget>
@ -435,7 +435,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:14 GMT"/>
</widget>
</child>
@ -445,7 +445,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:21 GMT"/>
</widget>
@ -456,7 +456,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Mon, 28 Feb 2005 08:16:28 GMT"/>
</widget>
@ -491,7 +491,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Tue, 08 Mar 2005 16:37:57 GMT"/>
</widget>
</child>
@ -501,7 +501,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_press_event" handler="on_menu_team_button_press_event" last_modification_time="Tue, 08 Mar 2005 16:37:48 GMT"/>
</widget>
@ -618,6 +618,31 @@
<child>
<widget class="GtkMenu" id="menu_user_menu">
<child>
<widget class="GtkMenuItem" id="menu_user_show_last_match">
<property name="visible">True</property>
<property name="label" translatable="yes">Show last match</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menu_user_show_last_match_activate" last_modification_time="Fri, 11 Mar 2005 15:22:26 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menu_user_show_last_stats">
<property name="visible">True</property>
<property name="label" translatable="yes">Show last match stats</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menu_user_show_last_stats_activate" last_modification_time="Fri, 11 Mar 2005 15:22:17 GMT"/>
<accelerator key="F2" modifiers="0" signal="activate"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="trennlinie9">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menu_next_user">
<property name="visible">True</property>
@ -627,7 +652,7 @@
<accelerator key="F9" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image197">
<widget class="GtkImage" id="image207">
<property name="visible">True</property>
<property name="stock">gtk-go-forward</property>
<property name="icon_size">1</property>
@ -649,7 +674,7 @@
<accelerator key="F8" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image198">
<widget class="GtkImage" id="image208">
<property name="visible">True</property>
<property name="stock">gtk-go-back</property>
<property name="icon_size">1</property>
@ -671,7 +696,7 @@
<accelerator key="F12" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image199">
<widget class="GtkImage" id="image209">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
@ -1307,6 +1332,54 @@
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkEventBox" id="eventbox_style">
<property name="visible">True</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<signal name="button_press_event" handler="on_eventbox_style_button_press_event" last_modification_time="Fri, 11 Mar 2005 15:30:28 GMT"/>
<child>
<widget class="GtkImage" id="image_style">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">2</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkEventBox" id="eventbox_boost">
<property name="visible">True</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<signal name="button_press_event" handler="on_eventbox_boost_button_press_event" last_modification_time="Fri, 11 Mar 2005 15:30:40 GMT"/>
<child>
<widget class="GtkImage" id="image_boost">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">2</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkEventBox" id="eventbox_team_name">
<property name="visible">True</property>

View File

@ -50,6 +50,7 @@
#define stat2 status[2]
#define stat3 status[3]
#define stat4 status[4]
#define old_stat status[5]
/**
* Exit codes.

View File

@ -7,6 +7,7 @@
#include "option.h"
#include "player.h"
#include "start_end.h"
#include "support.h"
#include "team.h"
#include "treeview.h"
#include "user.h"
@ -88,3 +89,27 @@ callback_player_clicked(gint idx, GdkEventButton *event)
treeview_show_user_player_list(&usr(current_user), 1);
}
}
/** Show the last match of the current user. */
void
callback_show_last_match(void)
{
gint i;
if(usr(current_user).live_game.units == NULL)
{
game_gui_show_warning("No match to show.");
return;
}
stat2 = current_user;
window_create(WINDOW_LIVE);
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.live, "treeview_stats")),
&usr(current_user).live_game);
live_game_set_match(&usr(current_user).live_game);
for(i=0;i<usr(current_user).live_game.units->len;i++)
game_gui_live_game_show_unit(&g_array_index(usr(current_user).live_game.units, LiveGameUnit, i));
}

View File

@ -9,4 +9,7 @@ callback_show_next_live_game(void);
void
callback_player_clicked(gint idx, GdkEventButton *event);
void
callback_show_last_match(void);
#endif

View File

@ -3,6 +3,7 @@
#include "enums.h"
#include "game_gui.h"
#include "main.h"
#include "team.h"
#include "treeview.h"
#include "variables.h"
@ -618,3 +619,78 @@ on_menu_manage_users_activate (GtkMenuItem *menuitem,
{
}
void
on_menu_user_show_last_match_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
stat0 = STATUS_SHOW_LAST_MATCH;
callback_show_last_match();
}
void
on_menu_user_show_last_stats_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
stat0 = STATUS_SHOW_LAST_MATCH_STATS;
treeview_show_game_stats(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")),
&usr(current_user).live_game);
}
gboolean
on_eventbox_style_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
gint new_style = -1;
if(event->type != GDK_BUTTON_PRESS)
return FALSE;
if(event->button == 1)
new_style = (usr(current_user).tm->style != 2) ?
usr(current_user).tm->style + 1 : -2;
else if(event->button == 3)
new_style = (usr(current_user).tm->style != -2) ?
usr(current_user).tm->style - 1 : 2;
else
return FALSE;
team_change_attribute_with_message(usr(current_user).tm, TEAM_ATTRIBUTE_STYLE, new_style);
game_gui_write_meters();
game_gui_write_radio_items();
return FALSE;
}
gboolean
on_eventbox_boost_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
gint new_boost = -1;
if(event->type != GDK_BUTTON_PRESS)
return FALSE;
if(event->button == 1)
new_boost = (usr(current_user).tm->boost != 1) ?
usr(current_user).tm->boost + 1 : -1;
else if(event->button == 3)
new_boost = (usr(current_user).tm->boost != -1) ?
usr(current_user).tm->boost - 1 : 1;
else
return FALSE;
team_change_attribute_with_message(usr(current_user).tm, TEAM_ATTRIBUTE_BOOST, new_boost);
game_gui_write_meters();
game_gui_write_radio_items();
return FALSE;
}

View File

@ -298,4 +298,22 @@ void
on_menu_manage_users_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menu_user_show_last_match_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menu_user_show_last_stats_activate (GtkMenuItem *menuitem,
gpointer user_data);
#endif
gboolean
on_eventbox_style_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
on_eventbox_boost_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);

View File

@ -61,6 +61,8 @@ enum Status0Value
/** We set this so that we know that
gui signals have to be ignored for the time being. */
STATUS_GUI_NO_REACTION,
STATUS_SHOW_LAST_MATCH,
STATUS_SHOW_LAST_MATCH_STATS,
STATUS_END
};

View File

@ -56,7 +56,8 @@ game_gui_live_game_show_unit(const LiveGameUnit *unit)
if(unit->event.type == LIVE_GAME_EVENT_START_MATCH)
{
gtk_widget_set_sensitive(button_live_close, FALSE);
gtk_widget_show(button_pause);
if(stat0 != STATUS_SHOW_LAST_MATCH)
gtk_widget_show(button_pause);
gtk_widget_hide(button_resume);
}
else if(unit->event.type == LIVE_GAME_EVENT_END_MATCH)
@ -187,6 +188,8 @@ game_gui_set_main_window_header(void)
game_gui_write_av_skills();
game_gui_write_radio_items();
game_gui_write_meters();
}
/** Set the average skills of the current team
@ -218,6 +221,33 @@ game_gui_write_radio_items(void)
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(boost[usr(current_user).tm->boost + 1]), TRUE);
}
/** Set the appropriate images for the style and boost meters. */
void
game_gui_write_meters(void)
{
gint i;
GtkImage *image_style = GTK_IMAGE(lookup_widget(window.main, "image_style")),
*image_boost = GTK_IMAGE(lookup_widget(window.main, "image_boost"));
gchar *image_style_files[5] =
{file_find_support_file(const_str("string_game_gui_style_all_out_defend_icon")),
file_find_support_file(const_str("string_game_gui_style_defend_icon")),
file_find_support_file(const_str("string_game_gui_style_balanced_icon")),
file_find_support_file(const_str("string_game_gui_style_attack_icon")),
file_find_support_file(const_str("string_game_gui_style_all_out_attack_icon"))};
gchar *image_boost_files[3] =
{file_find_support_file(const_str("string_game_gui_boost_anti_icon")),
file_find_support_file(const_str("string_game_gui_boost_off_icon")),
file_find_support_file(const_str("string_game_gui_boost_on_icon"))};
gtk_image_set_from_file(image_style, image_style_files[usr(current_user).tm->style + 2]);
gtk_image_set_from_file(image_boost, image_boost_files[usr(current_user).tm->boost + 1]);
for(i=0;i<5;i++)
g_free(image_style_files[i]);
for(i=0;i<3;i++)
g_free(image_boost_files[i]);
}
/** Set playing style etc. variables according to
the items.
@param widget The widget that received a click. */
@ -303,6 +333,8 @@ enum MainWindowInensitiveItems
INSENSITIVE_ITEM_MENU_REMOVE_FROM_TRANSFER_LIST,
INSENSITIVE_ITEM_MENU_FIRE,
INSENSITIVE_ITEM_MENU_MANAGE_USERS,
INSENSITIVE_ITEM_MENU_USER_SHOW_LAST,
INSENSITIVE_ITEM_MENU_USER_SHOW_LAST_STATS,
INSENSITIVE_ITEM_MENU_FINANCES_STADIUM,
INSENSITIVE_ITEM_MENU_HELP,
INSENSITIVE_ITEM_END
@ -341,6 +373,10 @@ game_gui_set_main_window_sensitivity(gboolean value)
lookup_widget(window.main, "menu_fire");
insensitive_items[INSENSITIVE_ITEM_MENU_MANAGE_USERS] =
lookup_widget(window.main, "menu_manage_users");
insensitive_items[INSENSITIVE_ITEM_MENU_USER_SHOW_LAST] =
lookup_widget(window.main, "menu_user_show_last_match");
insensitive_items[INSENSITIVE_ITEM_MENU_USER_SHOW_LAST_STATS] =
lookup_widget(window.main, "menu_user_show_last_stats");
insensitive_items[INSENSITIVE_ITEM_MENU_FINANCES_STADIUM] =
lookup_widget(window.main, "menu_finances_stadium");
insensitive_items[INSENSITIVE_ITEM_MENU_HELP] =

View File

@ -41,4 +41,7 @@ game_gui_write_av_skills(void);
void
game_gui_show_warning(gchar *text);
void
game_gui_write_meters(void);
#endif

View File

@ -42,15 +42,15 @@ create_main_window (void)
GtkWidget *trennlinie1;
GtkWidget *separatormenuitem1;
GtkWidget *start_editor;
GtkWidget *image194;
GtkWidget *image204;
GtkWidget *start_update;
GtkWidget *image195;
GtkWidget *image205;
GtkWidget *trennlinie2;
GtkWidget *menu_quit;
GtkWidget *menu_options;
GtkWidget *menu_options_menu;
GtkWidget *menu_preferences;
GtkWidget *image196;
GtkWidget *image206;
GtkWidget *trennlinie7;
GtkWidget *menu_notify;
GtkWidget *menu_job_offers;
@ -105,12 +105,15 @@ create_main_window (void)
GtkWidget *menu_shoots_penalties;
GtkWidget *menu_user;
GtkWidget *menu_user_menu;
GtkWidget *menu_user_show_last_match;
GtkWidget *menu_user_show_last_stats;
GtkWidget *trennlinie9;
GtkWidget *menu_next_user;
GtkWidget *image197;
GtkWidget *image207;
GtkWidget *menu_previous_user;
GtkWidget *image198;
GtkWidget *image208;
GtkWidget *menu_manage_users;
GtkWidget *image199;
GtkWidget *image209;
GtkWidget *menu_finances_stadium;
GtkWidget *menu_finances_stadium_menu;
GtkWidget *menu_increase_capacity;
@ -156,6 +159,10 @@ create_main_window (void)
GtkWidget *label_round;
GtkWidget *vseparator14;
GtkWidget *hbox48;
GtkWidget *eventbox_style;
GtkWidget *image_style;
GtkWidget *eventbox_boost;
GtkWidget *image_boost;
GtkWidget *eventbox_team_name;
GtkWidget *label_team;
GtkWidget *label_league;
@ -266,17 +273,17 @@ create_main_window (void)
gtk_widget_show (start_editor);
gtk_container_add (GTK_CONTAINER (menu_file_menu), start_editor);
image194 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
gtk_widget_show (image194);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (start_editor), image194);
image204 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
gtk_widget_show (image204);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (start_editor), image204);
start_update = gtk_image_menu_item_new_with_mnemonic (_("Start Bygfoot Online Update"));
gtk_widget_show (start_update);
gtk_container_add (GTK_CONTAINER (menu_file_menu), start_update);
image195 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU);
gtk_widget_show (image195);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (start_update), image195);
image205 = gtk_image_new_from_stock ("gtk-refresh", GTK_ICON_SIZE_MENU);
gtk_widget_show (image205);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (start_update), image205);
trennlinie2 = gtk_separator_menu_item_new ();
gtk_widget_show (trennlinie2);
@ -298,9 +305,9 @@ create_main_window (void)
gtk_widget_show (menu_preferences);
gtk_container_add (GTK_CONTAINER (menu_options_menu), menu_preferences);
image196 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
gtk_widget_show (image196);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image196);
image206 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU);
gtk_widget_show (image206);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image206);
trennlinie7 = gtk_separator_menu_item_new ();
gtk_widget_show (trennlinie7);
@ -368,25 +375,21 @@ 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));
@ -405,19 +408,16 @@ 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));
@ -436,19 +436,16 @@ 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));
@ -467,13 +464,11 @@ 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));
@ -528,6 +523,22 @@ create_main_window (void)
menu_user_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_user), menu_user_menu);
menu_user_show_last_match = gtk_menu_item_new_with_mnemonic (_("Show last match"));
gtk_widget_show (menu_user_show_last_match);
gtk_container_add (GTK_CONTAINER (menu_user_menu), menu_user_show_last_match);
menu_user_show_last_stats = gtk_menu_item_new_with_mnemonic (_("Show last match stats"));
gtk_widget_show (menu_user_show_last_stats);
gtk_container_add (GTK_CONTAINER (menu_user_menu), menu_user_show_last_stats);
gtk_widget_add_accelerator (menu_user_show_last_stats, "activate", accel_group,
GDK_F2, 0,
GTK_ACCEL_VISIBLE);
trennlinie9 = gtk_separator_menu_item_new ();
gtk_widget_show (trennlinie9);
gtk_container_add (GTK_CONTAINER (menu_user_menu), trennlinie9);
gtk_widget_set_sensitive (trennlinie9, FALSE);
menu_next_user = gtk_image_menu_item_new_with_mnemonic (_("Next user"));
gtk_widget_show (menu_next_user);
gtk_container_add (GTK_CONTAINER (menu_user_menu), menu_next_user);
@ -535,9 +546,9 @@ create_main_window (void)
GDK_F9, 0,
GTK_ACCEL_VISIBLE);
image197 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
gtk_widget_show (image197);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image197);
image207 = gtk_image_new_from_stock ("gtk-go-forward", GTK_ICON_SIZE_MENU);
gtk_widget_show (image207);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image207);
menu_previous_user = gtk_image_menu_item_new_with_mnemonic (_("Previous user"));
gtk_widget_show (menu_previous_user);
@ -546,9 +557,9 @@ create_main_window (void)
GDK_F8, 0,
GTK_ACCEL_VISIBLE);
image198 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
gtk_widget_show (image198);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image198);
image208 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU);
gtk_widget_show (image208);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image208);
menu_manage_users = gtk_image_menu_item_new_with_mnemonic (_("Manage users"));
gtk_widget_show (menu_manage_users);
@ -557,9 +568,9 @@ create_main_window (void)
GDK_F12, 0,
GTK_ACCEL_VISIBLE);
image199 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
gtk_widget_show (image199);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image199);
image209 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU);
gtk_widget_show (image209);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image209);
menu_finances_stadium = gtk_menu_item_new_with_mnemonic (_("FinStad"));
gtk_widget_show (menu_finances_stadium);
@ -795,6 +806,24 @@ create_main_window (void)
gtk_widget_show (hbox48);
gtk_box_pack_start (GTK_BOX (hbox18), hbox48, FALSE, FALSE, 0);
eventbox_style = gtk_event_box_new ();
gtk_widget_show (eventbox_style);
gtk_box_pack_start (GTK_BOX (hbox48), eventbox_style, TRUE, TRUE, 0);
image_style = create_pixmap (main_window, NULL);
gtk_widget_show (image_style);
gtk_container_add (GTK_CONTAINER (eventbox_style), image_style);
gtk_misc_set_padding (GTK_MISC (image_style), 2, 0);
eventbox_boost = gtk_event_box_new ();
gtk_widget_show (eventbox_boost);
gtk_box_pack_start (GTK_BOX (hbox48), eventbox_boost, TRUE, TRUE, 0);
image_boost = create_pixmap (main_window, NULL);
gtk_widget_show (image_boost);
gtk_container_add (GTK_CONTAINER (eventbox_boost), image_boost);
gtk_misc_set_padding (GTK_MISC (image_boost), 2, 0);
eventbox_team_name = gtk_event_box_new ();
gtk_widget_show (eventbox_team_name);
gtk_box_pack_start (GTK_BOX (hbox48), eventbox_team_name, FALSE, FALSE, 0);
@ -1135,6 +1164,12 @@ create_main_window (void)
g_signal_connect ((gpointer) menu_shoots_penalties, "activate",
G_CALLBACK (on_menu_shoots_penalties_activate),
NULL);
g_signal_connect ((gpointer) menu_user_show_last_match, "activate",
G_CALLBACK (on_menu_user_show_last_match_activate),
NULL);
g_signal_connect ((gpointer) menu_user_show_last_stats, "activate",
G_CALLBACK (on_menu_user_show_last_stats_activate),
NULL);
g_signal_connect ((gpointer) menu_next_user, "activate",
G_CALLBACK (on_menu_next_user_activate),
NULL);
@ -1192,6 +1227,12 @@ create_main_window (void)
g_signal_connect ((gpointer) button_help, "clicked",
G_CALLBACK (on_button_help_clicked),
NULL);
g_signal_connect ((gpointer) eventbox_style, "button_press_event",
G_CALLBACK (on_eventbox_style_button_press_event),
NULL);
g_signal_connect ((gpointer) eventbox_boost, "button_press_event",
G_CALLBACK (on_eventbox_boost_button_press_event),
NULL);
g_signal_connect ((gpointer) player_list1, "button_press_event",
G_CALLBACK (on_player_list1_button_press_event),
NULL);
@ -1221,15 +1262,15 @@ create_main_window (void)
GLADE_HOOKUP_OBJECT (main_window, trennlinie1, "trennlinie1");
GLADE_HOOKUP_OBJECT (main_window, separatormenuitem1, "separatormenuitem1");
GLADE_HOOKUP_OBJECT (main_window, start_editor, "start_editor");
GLADE_HOOKUP_OBJECT (main_window, image194, "image194");
GLADE_HOOKUP_OBJECT (main_window, image204, "image204");
GLADE_HOOKUP_OBJECT (main_window, start_update, "start_update");
GLADE_HOOKUP_OBJECT (main_window, image195, "image195");
GLADE_HOOKUP_OBJECT (main_window, image205, "image205");
GLADE_HOOKUP_OBJECT (main_window, trennlinie2, "trennlinie2");
GLADE_HOOKUP_OBJECT (main_window, menu_quit, "menu_quit");
GLADE_HOOKUP_OBJECT (main_window, menu_options, "menu_options");
GLADE_HOOKUP_OBJECT (main_window, menu_options_menu, "menu_options_menu");
GLADE_HOOKUP_OBJECT (main_window, menu_preferences, "menu_preferences");
GLADE_HOOKUP_OBJECT (main_window, image196, "image196");
GLADE_HOOKUP_OBJECT (main_window, image206, "image206");
GLADE_HOOKUP_OBJECT (main_window, trennlinie7, "trennlinie7");
GLADE_HOOKUP_OBJECT (main_window, menu_notify, "menu_notify");
GLADE_HOOKUP_OBJECT (main_window, menu_job_offers, "menu_job_offers");
@ -1280,12 +1321,15 @@ create_main_window (void)
GLADE_HOOKUP_OBJECT (main_window, menu_shoots_penalties, "menu_shoots_penalties");
GLADE_HOOKUP_OBJECT (main_window, menu_user, "menu_user");
GLADE_HOOKUP_OBJECT (main_window, menu_user_menu, "menu_user_menu");
GLADE_HOOKUP_OBJECT (main_window, menu_user_show_last_match, "menu_user_show_last_match");
GLADE_HOOKUP_OBJECT (main_window, 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, image197, "image197");
GLADE_HOOKUP_OBJECT (main_window, image207, "image207");
GLADE_HOOKUP_OBJECT (main_window, menu_previous_user, "menu_previous_user");
GLADE_HOOKUP_OBJECT (main_window, image198, "image198");
GLADE_HOOKUP_OBJECT (main_window, image208, "image208");
GLADE_HOOKUP_OBJECT (main_window, menu_manage_users, "menu_manage_users");
GLADE_HOOKUP_OBJECT (main_window, image199, "image199");
GLADE_HOOKUP_OBJECT (main_window, image209, "image209");
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_increase_capacity, "menu_increase_capacity");
@ -1331,6 +1375,10 @@ create_main_window (void)
GLADE_HOOKUP_OBJECT (main_window, label_round, "label_round");
GLADE_HOOKUP_OBJECT (main_window, vseparator14, "vseparator14");
GLADE_HOOKUP_OBJECT (main_window, hbox48, "hbox48");
GLADE_HOOKUP_OBJECT (main_window, eventbox_style, "eventbox_style");
GLADE_HOOKUP_OBJECT (main_window, image_style, "image_style");
GLADE_HOOKUP_OBJECT (main_window, eventbox_boost, "eventbox_boost");
GLADE_HOOKUP_OBJECT (main_window, image_boost, "image_boost");
GLADE_HOOKUP_OBJECT (main_window, eventbox_team_name, "eventbox_team_name");
GLADE_HOOKUP_OBJECT (main_window, label_team, "label_team");
GLADE_HOOKUP_OBJECT (main_window, label_league, "label_league");

View File

@ -1536,3 +1536,11 @@ live_game_resume(void)
live_game_calculate_fixture(usr(stat2).live_game.fix);
}
/** Set the match variable to the live game.
@param live_game The live game 'match' will point to. */
void
live_game_set_match(LiveGame *live_game)
{
match = live_game;
}

View File

@ -106,4 +106,7 @@ live_game_finish_unit(void);
LiveGameUnit*
live_game_unit_before(const LiveGameUnit* unit, gint gap);
void
live_game_set_match(LiveGame *live_game);
#endif

View File

@ -113,8 +113,8 @@ enum LiveGameUnitArea
enum LiveGameStatArray
{
LIVE_GAME_STAT_ARRAY_SCORERS = 0,
LIVE_GAME_STAT_ARRAY_REDS,
LIVE_GAME_STAT_ARRAY_YELLOWS,
LIVE_GAME_STAT_ARRAY_REDS,
LIVE_GAME_STAT_ARRAY_INJURED,
LIVE_GAME_STAT_ARRAY_END
};

View File

@ -175,7 +175,10 @@ on_button_live_close_clicked (GtkButton *button,
gpointer user_data)
{
stat2 = -1;
callback_show_next_live_game();
if(stat0 != STATUS_SHOW_LAST_MATCH)
callback_show_next_live_game();
else
window_destroy(&window.live, TRUE);
}

View File

@ -1,6 +1,7 @@
#include "cup.h"
#include "fixture.h"
#include "free.h"
#include "game_gui.h"
#include "league.h"
#include "maths.h"
#include "option.h"
@ -604,3 +605,71 @@ team_rearrange(Team *tm)
player_get_cskill(player_of(tm, i), player_of(tm, i)->cpos) : player_of(tm, i)->skill;
}
}
/** Return the name of the current setting of a team attribute, e.g. style.
@param tm The team.
@param attribute The attribute. */
gchar*
team_attribute_to_char(gint attribute, gint value)
{
switch(attribute)
{
default:
g_warning("team_attribute_to_char: unknown attribute %d\n", attribute);
break;
case TEAM_ATTRIBUTE_STYLE:
switch(value)
{
case -2:
return _("ALL OUT DEFEND");
case -1:
return _("DEFEND");
case 0:
return _("BALANCED");
case 1:
return _("ATTACK");
case 2:
return _("ALL OUT ATTACK");
}
break;
case TEAM_ATTRIBUTE_BOOST:
switch(value)
{
case -1:
return _("ANTI");
case 0:
return _("OFF");
case 1:
return _("ON");
}
break;
}
return NULL;
}
/** Change a team attribute of the current user and print a message.
@param attribute The attribute.
@param new_value The new value. */
void
team_change_attribute_with_message(Team *tm, gint attribute, gint new_value)
{
gchar buf[SMALL];
switch(attribute)
{
default:
g_warning("team_attribute_to_char: unknown attribute %d\n", attribute);
break;
case TEAM_ATTRIBUTE_STYLE:
usr(current_user).tm->style = new_value;
sprintf(buf, "Team style changed to %s.", team_attribute_to_char(attribute, new_value));
break;
case TEAM_ATTRIBUTE_BOOST:
usr(current_user).tm->boost = new_value;
sprintf(buf, "Boost changed to %s.", team_attribute_to_char(attribute, new_value));
break;
}
game_gui_print_message(buf);
}

View File

@ -78,4 +78,10 @@ team_find_appropriate_structure(const Team *tm);
void
team_rearrange(Team *tm);
gchar*
team_attribute_to_char(gint attribute, gint value);
void
team_change_attribute_with_message(Team * tm, gint attribute, gint new_value);
#endif

View File

@ -3,20 +3,6 @@
#include "bygfoot.h"
/**
Playing styles for teams.
@see The match result calculating functions.
*/
enum TeamPlayingStyle
{
PLAYING_STYLE_ALL_OUT_DEFEND = -2,
PLAYING_STYLE_DEFEND,
PLAYING_STYLE_BALANCED,
PLAYING_STYLE_ATTACK,
PLAYING_STYLE_ALL_OUT_ATTACK,
PLAYING_STYLE_END
};
/** @see team_return_league_cup_value_int() */
enum LeagueCupValue
{
@ -36,6 +22,14 @@ enum LeagueCupValue
LEAGUE_CUP_VALUE_END
};
/** Some team attributes. */
enum TeamAttribute
{
TEAM_ATTRIBUTE_STYLE = 0,
TEAM_ATTRIBUTE_BOOST,
TEAM_ATTRIBUTE_END
};
/** The stadium of a team. */
typedef struct
{

View File

@ -180,21 +180,21 @@ treeview_live_game_icon(gint event_type)
else if(event_type == LIVE_GAME_EVENT_STRUCTURE_CHANGE)
return const_str("string_live_game_event_structure_change_icon");
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_DEFEND)
return const_str("string_live_game_event_style_change_all_out_defend_icon");
return const_str("string_game_gui_style_all_out_defend_icon");
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_DEFEND)
return const_str("string_live_game_event_style_change_defend_icon");
return const_str("string_game_gui_style_defend_icon");
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_BALANCED)
return const_str("string_live_game_event_style_change_balanced_icon");
return const_str("string_game_gui_style_balanced_icon");
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_ATTACK)
return const_str("string_live_game_event_style_change_attack_icon");
return const_str("string_game_gui_style_attack_icon");
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_ATTACK)
return const_str("string_live_game_event_style_change_all_out_attack_icon");
return const_str("string_game_gui_style_all_out_attack_icon");
else if(event_type == LIVE_GAME_EVENT_BOOST_CHANGE_ANTI)
return const_str("string_live_game_event_boost_change_anti_icon");
return const_str("string_game_gui_boost_anti_icon");
else if(event_type == LIVE_GAME_EVENT_BOOST_CHANGE_OFF)
return const_str("string_live_game_event_boost_change_off_icon");
return const_str("string_game_gui_boost_off_icon");
else if(event_type == LIVE_GAME_EVENT_BOOST_CHANGE_ON)
return const_str("string_live_game_event_boost_change_on_icon");
return const_str("string_game_gui_boost_on_icon");
else
return "";
}

View File

@ -27,7 +27,7 @@ GArray *constants;
GArray *transfer_list;
/** These help us keep track of what's happening. */
gint status[5];
gint status[6];
/** The currently selected rows in the treeviews. */
gint selected_row[2];

View File

@ -127,7 +127,8 @@ window_create(gint window_type)
gtk_window_set_title(GTK_WINDOW(wind), buf);
gtk_widget_show(wind);
if(popups_active < old_popups_active && window.main != NULL)
if(popups_active != old_popups_active &&
window.main != NULL)
gtk_widget_set_sensitive(window.main, FALSE);
return wind;

View File

@ -339,6 +339,17 @@ string_game_gui_live_game_scale_color_chance orange
string_game_gui_live_game_scale_color_goal red
string_game_gui_live_game_scale_color_miss lightgreen
# meter icons (style, boost) in the main window
string_game_gui_style_all_out_attack_icon style_all_atk.png
string_game_gui_style_attack_icon style_atk.png
string_game_gui_style_balanced_icon style_bal.png
string_game_gui_style_defend_icon style_def.png
string_game_gui_style_all_out_defend_icon style_all_def.png
string_game_gui_boost_on_icon boost_on.png
string_game_gui_boost_off_icon boost_off.png
string_game_gui_boost_anti_icon boost_anti.png
# default background and foreground in treeviews
string_treeview_cell_color_default_background white
string_treeview_cell_color_default_foreground black
@ -381,8 +392,8 @@ string_live_game_possession_color darkblue
# icons used in live games
string_live_game_event_start_match_icon whistle.png
string_live_game_event_lost_possession_icon
string_live_game_event_penalty_icon striker.png
string_live_game_event_scoring_chance_icon striker.png
string_live_game_event_penalty_icon scoring_chance.png
string_live_game_event_scoring_chance_icon scoring_chance.png
string_live_game_event_goal_icon goal.png
string_live_game_event_own_goal_icon own_goal.png
string_live_game_event_post_icon
@ -398,11 +409,3 @@ string_live_game_event_stadium_fire_icon
string_live_game_event_stadium_riots_icon
string_live_game_event_substitution_icon sub.png
string_live_game_event_structure_change_icon structure_change.png
string_live_game_event_style_change_all_out_defend_icon style_change.png
string_live_game_event_style_change_defend_icon style_change.png
string_live_game_event_style_change_balanced_icon style_change.png
string_live_game_event_style_change_attack_icon style_change.png
string_live_game_event_style_change_all_out_attack_icon boost_change.png
string_live_game_event_boost_change_anti_icon boost_change.png
string_live_game_event_boost_change_off_icon style_change.png
string_live_game_event_boost_change_on_icon boost_change.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B