1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2025-02-03 01:07:51 +01:00

Live game can be tested a bit.

This commit is contained in:
gyboth 2005-01-10 15:24:15 +00:00
parent 6fa0ca48f8
commit b5d4b84eb9
14 changed files with 136 additions and 41 deletions

View File

@ -10,7 +10,7 @@
# using wget to retrieve patches from the homepage
# version number
version="0.6"
version="0.8"
# the bygfoot release version the script is shipped with
relversion=VERSION
# the current release version on the server
@ -57,6 +57,10 @@ format_src=.tar.bz2
format_srpm=.src.rpm
format_deb=-1_i386.deb
format=
# which cvs version to get
cvs_version1=bygfoot-unstable
cvs_version2=bygfoot2-unstable
cvs_version=
# options
@ -676,8 +680,55 @@ function get_mode()
function get_cvs()
{
echo
echo "** b-u: Which CVS version would you like to download?"
echo "** b-u: - [1] 1.7 branch"
echo "** b-u: - (2) 1.9 branch"
read tempvar
if [ -z $tempvar ]; then
cvs_version=$cvs_version1
else
if [ $tempvar -eq 2 ]; then
cvs_version=$cvs_version2
else
cvs_version=$cvs_version1
fi
fi
echo
echo "** b-u: If you'd like to check out as a developer, enter your"
echo "** b-u: SourceForge.net username. Press RETURN to download anonymously."
read tempvar
if [ -z $tempvar ]; then
cvs_command="cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bygfoot"
else
cvs_command="cvs -d:ext:$tempvar@cvs.sf.net:/cvsroot/bygfoot"
fi
cd $tmpdir
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bygfoot checkout bygfoot-unstable
$cvs_command checkout $cvs_version
if [ $recompile -eq 0 -a $auto -eq 0 ]; then
echo "** b-u: Would you like me to execute 'autogen.sh && make' ? ([y]/n)"
read tempvar
if [ ! -z $tempvar ]; then
if [ $tempvar != "y" ]; then
echo
echo "** b-u: done."
exit $EXITOK
fi
fi
fi
if [ $recompile -ne -1 ]; then
cd $cvs_version
./autogen.sh && make
fi
exit $EXITOK
}

View File

@ -1414,7 +1414,7 @@
<property name="metric">GTK_PIXELS</property>
<property name="lower">0</property>
<property name="upper">120</property>
<property name="position">77.2603</property>
<property name="position">66.5753</property>
<property name="max_size">120</property>
</widget>
<packing>
@ -1666,6 +1666,27 @@
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spinbutton_speed">
<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">0 -10 20 1 10 10</property>
<signal name="value_changed" handler="on_spinbutton_speed_value_changed" last_modification_time="Mon, 10 Jan 2005 15:04:50 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">5</property>

View File

@ -146,7 +146,30 @@ void
on_button_new_week_clicked (GtkButton *button,
gpointer user_data)
{
/*d*/
gint i, j, k;
Fixture *fix;/* = &g_array_index(lig(0).fixtures, Fixture, */
/* math_rndi(0, lig(0).fixtures->len - 1)); */
for(k=0;k<lig(0).fixtures->len;k++)
if(g_array_index(lig(0).fixtures, Fixture, k).week_number == week &&
g_array_index(lig(0).fixtures, Fixture, k).week_round_number == 1)
{
fix = &g_array_index(lig(0).fixtures, Fixture, k);
printf("\n");
for(j=0;j<2;j++)
{
printf("%s %d %d %.1f\n", fix->teams[j]->name->str, fix->teams[j]->structure,
fix->teams[j]->style, team_average_cskill(fix->teams[j]));
}
live_game_calculate_fixture(fix);
printf("%d : %d\n", math_sum_int_array(fix->result[0], 3),
math_sum_int_array(fix->result[1], 3));
}
week++;
}
@ -626,28 +649,6 @@ on_treeview_right_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
/*d*/
gint i, j, k;
Fixture *fix;/* = &g_array_index(lig(0).fixtures, Fixture, */
/* math_rndi(0, lig(0).fixtures->len - 1)); */
for(k=0;k<lig(0).fixtures->len;k++)
if(g_array_index(lig(0).fixtures, Fixture, k).week_number == 1 &&
g_array_index(lig(0).fixtures, Fixture, k).week_round_number == 1)
{
fix = &g_array_index(lig(0).fixtures, Fixture, k);
printf("\n");
for(j=0;j<2;j++)
{
printf("%s %d %d %.1f\n", fix->teams[j]->name->str, fix->teams[j]->structure,
fix->teams[j]->style, team_average_cskill(fix->teams[j]));
}
live_game_calculate_fixture(fix);
printf("%d : %d\n", math_sum_int_array(fix->result[0], 3),
math_sum_int_array(fix->result[1], 3));
}
return FALSE;
}

View File

@ -47,7 +47,7 @@ enum OptionValue
OPT_BOOL_CONF_QUIT, /**< Quit confirmation. */
OPT_BOOL_OVERWRITE, /**< Clicking on save overwrites current save game. */
OPT_BOOL_SHOW_LIVE, /**< Whether live game is shown. */
OPT_LIVE_DURATION, /**< Live game speed. */
OPT_LIVE_SPEED, /**< Live game speed. */
OPT_BOOL_LIVE_TENDENCY, /**< Tendency bar. */
OPT_BOOL_MAXIMIZE, /**< Whether to start maximized. */
OPT_BOOL_NOTIFY, /**< Whether transfer list notification is on. */

View File

@ -239,7 +239,7 @@ file_write_opt_names(gchar opt_names[][50], gchar player_list_att_names[][PLAYER
strcpy(opt_names[OPT_BOOL_CONF_QUIT], "confirm_quit");
strcpy(opt_names[OPT_BOOL_OVERWRITE], "save_will_ovewrite");
strcpy(opt_names[OPT_BOOL_SHOW_LIVE], "show_live_game");
strcpy(opt_names[OPT_LIVE_DURATION], "live_game_duration");
strcpy(opt_names[OPT_LIVE_SPEED], "live_game_speed");
strcpy(opt_names[OPT_BOOL_LIVE_TENDENCY], "show_tendency_bar");
strcpy(opt_names[OPT_BOOL_MAXIMIZE], "maximize_main_window");

View File

@ -307,9 +307,6 @@ create_main_window (void)
menu_quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
gtk_widget_show (menu_quit);
gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_quit);
gtk_widget_add_accelerator (menu_quit, "activate", accel_group,
GDK_q, GDK_CONTROL_MASK,
GTK_ACCEL_VISIBLE);
options1 = gtk_menu_item_new_with_mnemonic (_("Options"));
gtk_widget_show (options1);
@ -657,7 +654,7 @@ create_main_window (void)
gtk_container_set_border_width (GTK_CONTAINER (button_quit), 2);
gtk_tooltips_set_tip (tooltips, button_quit, _("Quit (Ctrl - Q)"), NULL);
gtk_widget_add_accelerator (button_quit, "clicked", accel_group,
GDK_q, GDK_CONTROL_MASK,
GDK_q, 0,
GTK_ACCEL_VISIBLE);
image13 = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_BUTTON);
@ -998,9 +995,6 @@ create_main_window (void)
gtk_box_pack_start (GTK_BOX (vbox16), button_browse_back, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (button_browse_back), 2);
gtk_tooltips_set_tip (tooltips, button_browse_back, _("Previous (Q)"), NULL);
gtk_widget_add_accelerator (button_browse_back, "clicked", accel_group,
GDK_q, 0,
GTK_ACCEL_VISIBLE);
image10 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image10);

View File

@ -57,7 +57,7 @@
/** Base probability for possession change. */
#define CONSTANT_LIVE_GAME_POSSESSION_CHANGES 0.2
/** Influence of attack/defense values on the possession change. */
#define CONSTANT_LIVE_GAME_POSSESSION_TEAM_EXPONENT 5
#define CONSTANT_LIVE_GAME_POSSESSION_TEAM_EXPONENT 4
/** Probability of NOT having a scoring chance after one
possession. With each possession the probability gets smaller. */

View File

@ -52,11 +52,11 @@ main_init(gint argc, gchar *argv[])
srandom((unsigned)time(NULL));
file_add_support_directory_recursive(PACKAGE_DATA_DIR "/" PACKAGE "/support_files");
sprintf(buf, "%s/.bygfoot", g_get_home_dir());
file_add_support_directory_recursive(buf);
sprintf(buf, "%s/support_files", pwd);
g_free(pwd);
file_add_support_directory_recursive(buf);
sprintf(buf, "%s/.bygfoot", g_get_home_dir());
file_add_support_directory_recursive(buf);
main_init_variables();
}

View File

@ -232,3 +232,12 @@ on_button_resume_clicked (GtkButton *button,
{
}
void
on_spinbutton_speed_value_changed (GtkSpinButton *spinbutton,
gpointer user_data)
{
options[OPT_LIVE_SPEED] =
gtk_spin_button_get_value_as_int(spinbutton);
}

View File

@ -116,3 +116,7 @@ on_button_resume_clicked (GtkButton *button,
gpointer user_data);
#endif
void
on_spinbutton_speed_value_changed (GtkSpinButton *spinbutton,
gpointer user_data);

View File

@ -835,6 +835,8 @@ create_window_live (void)
GtkWidget *image57;
GtkWidget *label73;
GtkWidget *button_live_close;
GtkObject *spinbutton_speed_adj;
GtkWidget *spinbutton_speed;
GtkAccelGroup *accel_group;
accel_group = gtk_accel_group_new ();
@ -857,7 +859,7 @@ create_window_live (void)
gtk_widget_show (hruler_live);
gtk_box_pack_start (GTK_BOX (vbox36), hruler_live, FALSE, TRUE, 0);
gtk_widget_set_sensitive (hruler_live, FALSE);
gtk_ruler_set_range (GTK_RULER (hruler_live), 0, 120, 77.2603, 120);
gtk_ruler_set_range (GTK_RULER (hruler_live), 0, 120, 66.5753, 120);
hbox50 = gtk_hbox_new (FALSE, 3);
gtk_widget_show (hbox50);
@ -941,6 +943,12 @@ create_window_live (void)
gtk_box_pack_start (GTK_BOX (hbox48), button_live_close, FALSE, FALSE, 0);
gtk_widget_set_sensitive (button_live_close, FALSE);
spinbutton_speed_adj = gtk_adjustment_new (0, -10, 20, 1, 10, 10);
spinbutton_speed = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton_speed_adj), 1, 0);
gtk_widget_show (spinbutton_speed);
gtk_box_pack_end (GTK_BOX (hbox48), spinbutton_speed, FALSE, TRUE, 0);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton_speed), TRUE);
g_signal_connect ((gpointer) window_live, "delete_event",
G_CALLBACK (on_live_window_delete_event),
NULL);
@ -953,6 +961,9 @@ create_window_live (void)
g_signal_connect ((gpointer) button_live_close, "clicked",
G_CALLBACK (on_button_live_close_clicked),
NULL);
g_signal_connect ((gpointer) spinbutton_speed, "value_changed",
G_CALLBACK (on_spinbutton_speed_value_changed),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (window_live, window_live, "window_live");
@ -977,6 +988,7 @@ create_window_live (void)
GLADE_HOOKUP_OBJECT (window_live, image57, "image57");
GLADE_HOOKUP_OBJECT (window_live, label73, "label73");
GLADE_HOOKUP_OBJECT (window_live, button_live_close, "button_live_close");
GLADE_HOOKUP_OBJECT (window_live, spinbutton_speed, "spinbutton_speed");
gtk_window_add_accel_group (GTK_WINDOW (window_live), accel_group);

View File

@ -47,8 +47,8 @@ team_new(void)
new.symbol = g_string_new("");
new.clid = new.id = -1;
new.structure = 442;//team_assign_playing_structure();
new.style = 0;//team_assign_playing_style();
new.structure = team_assign_playing_structure();
new.style = team_assign_playing_style();
new.stadium = team_stadium_new();

View File

@ -441,7 +441,7 @@ treeview_live_game_show_game_unit(const LiveGameUnit *unit)
progress_bar = GTK_PROGRESS_BAR(lookup_widget(live_game.window, "progressbar_live"));
gtk_progress_bar_set_fraction(progress_bar, (gfloat)live_game_unit_get_minute(unit) / 120);
usleep(500);
usleep(500500 + options[OPT_LIVE_SPEED] * 50000);
while(gtk_events_pending())
gtk_main_iteration();

View File

@ -90,6 +90,9 @@ window_create(gint window_type)
case WINDOW_LIVE:
window = create_window_live();
window_set_version(window);
gtk_spin_button_set_value(
GTK_SPIN_BUTTON(lookup_widget(window, "spinbutton_speed")),
(gfloat)options[OPT_LIVE_SPEED]);
break;
}