diff --git a/src/misc_callbacks.c b/src/misc_callbacks.c index 73a3153e..778fbbca 100644 --- a/src/misc_callbacks.c +++ b/src/misc_callbacks.c @@ -297,12 +297,18 @@ on_spinbutton_speed_button_press_event (GtkWidget *widget, { if(event->button == 3) { - if(option_int("int_opt_user_live_game_speed", &usr(stat2).options) == 0) - option_set_int("int_opt_user_live_game_speed", &usr(stat2).options, 30); - else if(option_int("int_opt_user_live_game_speed", &usr(stat2).options) == 30) - option_set_int("int_opt_user_live_game_speed", &usr(stat2).options, 20); - else + if(option_int("int_opt_user_live_game_speed", &usr(stat2).options) == + -rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) / + (gfloat)(const_int("int_game_gui_live_game_speed_grad")))) option_set_int("int_opt_user_live_game_speed", &usr(stat2).options, 0); + else if(option_int("int_opt_user_live_game_speed", &usr(stat2).options) == 0) + option_set_int("int_opt_user_live_game_speed", &usr(stat2).options, + -rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) / + (gfloat)(const_int("int_game_gui_live_game_speed_grad") * 2))); + else + option_set_int("int_opt_user_live_game_speed", &usr(stat2).options, + -rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) / + (gfloat)(const_int("int_game_gui_live_game_speed_grad")))); gtk_spin_button_set_value( GTK_SPIN_BUTTON(lookup_widget(window.live, "spinbutton_speed")), diff --git a/src/option_gui.c b/src/option_gui.c index 555def0a..a7a08366 100644 --- a/src/option_gui.c +++ b/src/option_gui.c @@ -329,6 +329,10 @@ option_gui_write_spin_widgets(gint **spin_options, GtkSpinButton **spin_widgets) 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"); + gtk_spin_button_set_range(GTK_SPIN_BUTTON(spin_widgets[SPIN_OPT_LIVE_SPEED]), 0, + -rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) / + (gfloat)(const_int("int_game_gui_live_game_speed_grad")))); + spin_widgets[SPIN_OPT_LIVE_VERBOSITY] = GTK_SPIN_BUTTON(lookup_widget(window.options, "spinbutton_live_verbosity")); spin_options[SPIN_OPT_LIVE_VERBOSITY] = opt_user_intp("int_opt_user_live_game_verbosity"); diff --git a/src/window.c b/src/window.c index b5970e2a..ddc535c3 100644 --- a/src/window.c +++ b/src/window.c @@ -412,9 +412,16 @@ window_show_transfer_dialog(const gchar *text) void window_live_set_spinbuttons(void) { - gtk_spin_button_set_value( - GTK_SPIN_BUTTON(lookup_widget(window.live, "spinbutton_speed")), - (gfloat)option_int("int_opt_user_live_game_speed", &usr(stat2).options)); + GtkSpinButton *sb_speed = + GTK_SPIN_BUTTON(lookup_widget(window.live, "spinbutton_speed")); + + gtk_spin_button_set_range(sb_speed, 0, + -rint((gfloat)(const_int("int_game_gui_live_game_speed_max") - 10) / + (gfloat)(const_int("int_game_gui_live_game_speed_grad")))); + + gtk_spin_button_set_value(sb_speed, + (gfloat)option_int("int_opt_user_live_game_speed", + &usr(stat2).options)); gtk_spin_button_set_value( GTK_SPIN_BUTTON(lookup_widget(window.live, "spinbutton_verbosity")), (gfloat)option_int("int_opt_user_live_game_verbosity", &usr(stat2).options)); diff --git a/support_files/bygfoot_constants b/support_files/bygfoot_constants index c91bc288..24e6706c 100644 --- a/support_files/bygfoot_constants +++ b/support_files/bygfoot_constants @@ -333,8 +333,8 @@ float_game_gui_live_game_scale_chance 4500 float_game_gui_live_game_scale_range 100000 # live game speed (milliseconds -int_game_gui_live_game_speed_grad -66683 -int_game_gui_live_game_speed_max 3000000 +int_game_gui_live_game_speed_grad -87500 +int_game_gui_live_game_speed_max 3500010 # factor changing the speed when penalties float_game_gui_live_game_speed_penalties_factor 20000