diff --git a/bygfoot_options.glade b/bygfoot_options.glade
index 7dc8f8d4..659b4cfc 100644
--- a/bygfoot_options.glade
+++ b/bygfoot_options.glade
@@ -17,6 +17,8 @@
False
GDK_WINDOW_TYPE_HINT_NORMAL
GDK_GRAVITY_NORTH_WEST
+ True
+ False
@@ -261,6 +263,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -302,6 +308,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -352,6 +362,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -376,6 +390,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -400,6 +418,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -468,6 +490,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -573,6 +599,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -615,6 +645,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -728,6 +762,8 @@
True
+ False
+ True
@@ -767,6 +803,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
tab
@@ -845,6 +885,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -869,6 +913,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1065,6 +1113,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
tab
@@ -1149,6 +1201,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1189,6 +1245,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1318,6 +1378,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
tab
@@ -1346,6 +1410,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1370,6 +1438,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1394,6 +1466,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1418,6 +1494,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1442,6 +1522,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1466,6 +1550,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1490,6 +1578,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1514,6 +1606,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1538,6 +1634,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1562,6 +1662,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1586,6 +1690,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1610,6 +1718,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1634,6 +1746,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1658,6 +1774,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1682,6 +1802,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1706,6 +1830,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1730,6 +1858,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -1754,6 +1886,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -2602,6 +2738,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -2626,6 +2766,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
1
@@ -2650,6 +2794,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
2
@@ -2696,6 +2844,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
tab
@@ -2792,6 +2944,10 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
0
@@ -2861,6 +3017,254 @@
0.5
0
0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ tab
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ Default hotel
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.10000000149
+ 0.5
+ 4
+ 3
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ True
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ 10
+ True
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ Default recreation:
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.10000000149
+ 0.5
+ 3
+ 3
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ False
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 1 0 10 1 10 10
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ 10
+ True
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ Default training:
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.10000000149
+ 0.5
+ 3
+ 3
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ label48
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+ False
+ False
+
+
+
+
+
+ True
+ Training camp
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
tab
diff --git a/bygfoot_training.glade b/bygfoot_training.glade
index 3d9c03a1..491dfe6d 100755
--- a/bygfoot_training.glade
+++ b/bygfoot_training.glade
@@ -45,54 +45,6 @@
-
-
- 450
- 16
- True
-
-
- 25
- 235
-
-
-
-
-
- 110
- 25
- True
- True
- gtk-cancel
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
- 376
- 254
-
-
-
-
-
- 110
- 25
- True
- True
- gtk-apply
- True
- GTK_RELIEF_NORMAL
- True
-
-
-
- 256
- 254
-
-
-
450
@@ -210,49 +162,6 @@
-
-
- 200
- 21
- True
- True
- First-Class Hotel
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
-
-
-
- 24
- 40
-
-
-
-
-
- 200
- 21
- True
- True
- Premium Hotel
- True
- GTK_RELIEF_NORMAL
- True
- False
- False
- True
- rb_camp2
-
-
-
- 24
- 64
-
-
-
30
@@ -369,24 +278,6 @@
-
-
- 200
- 36
- True
- True
- GTK_POS_RIGHT
- 1
- GTK_UPDATE_CONTINUOUS
- False
- 0 1 10 1 0 0
-
-
- 220
- 120
-
-
-
30
@@ -414,6 +305,24 @@
+
+
+ 200
+ 36
+ True
+ True
+ GTK_POS_RIGHT
+ 1
+ GTK_UPDATE_CONTINUOUS
+ False
+ 0 1 10 1 0 0
+
+
+ 220
+ 120
+
+
+
200
@@ -428,7 +337,6 @@
False
False
True
- rb_camp2
@@ -436,6 +344,118 @@
16
+
+
+
+ 200
+ 21
+ True
+ True
+ First-Class Hotel
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+ rb_camp1
+
+
+
+ 24
+ 40
+
+
+
+
+
+ 200
+ 21
+ True
+ True
+ Premium Hotel
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+ rb_camp1
+
+
+
+ 24
+ 64
+
+
+
+
+
+ 450
+ 16
+ True
+
+
+ 25
+ 232
+
+
+
+
+
+ 110
+ 35
+ True
+ True
+ gtk-apply
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+ 256
+ 254
+
+
+
+
+
+ 110
+ 35
+ True
+ True
+ gtk-cancel
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+ 376
+ 254
+
+
+
+
+
+ 208
+ 21
+ True
+ True
+ Save settings as default
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+ 24
+ 264
+
+
diff --git a/src/bygfoot.h b/src/bygfoot.h
index cb4c6cbd..3d9f31a8 100644
--- a/src/bygfoot.h
+++ b/src/bygfoot.h
@@ -40,7 +40,7 @@
/**
* Program version number and year (copyright).
*/
-#define VERS "2.2.1"
+#define VERS "2.3.0"
#define YEAR "2005 - 2008"
/** Home dir name */
diff --git a/src/callbacks.c b/src/callbacks.c
index 5bb79458..ed07d0b9 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -1283,6 +1283,19 @@ on_training_camp_activate (GtkMenuItem *menuitem,
return;
}
- window_show_training_camp();
+ if(current_user.counters[COUNT_USER_TRAININGS_WEEK] ==
+ const_int("int_training_camps_week"))
+ {
+ game_gui_print_message(_("Your team has already had enough training camps this week."));
+ return;
+ }
+ if(current_user.counters[COUNT_USER_TRAININGS_LEFT_SEASON] == 0)
+ {
+ game_gui_print_message(_("You've reached the limit of %d training camps for the season."),
+ const_int("int_training_camps_per_season"));
+ return;
+ }
+
+ window_show_training_camp();
}
diff --git a/src/option_gui.c b/src/option_gui.c
index df8b569d..3d8201f4 100644
--- a/src/option_gui.c
+++ b/src/option_gui.c
@@ -31,6 +31,7 @@
#include "option_gui.h"
#include "misc.h"
#include "support.h"
+#include "training.h"
#include "treeview.h"
#include "user.h"
#include "variables.h"
@@ -350,6 +351,7 @@ enum SpinOptions
SPIN_OPT_LIVE_VERBOSITY,
SPIN_OPT_CONTRACT,
SPIN_OPT_BET_WAGER,
+ SPIN_OPT_TRAINING_CAMP_RECREATION,
SPIN_OPT_END
};
@@ -379,6 +381,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");
+ spin_widgets[SPIN_OPT_TRAINING_CAMP_RECREATION] =
+ GTK_SPIN_BUTTON(lookup_widget(window.options, "spinbutton_recreation"));
+ spin_options[SPIN_OPT_TRAINING_CAMP_RECREATION] = opt_user_intp("int_opt_user_training_camp_recreation");
+
/** Note the spinbutton value so that it doesn't get lost
when setting the range. */
tmp = gtk_spin_button_get_value_as_int(spin_widgets[SPIN_OPT_LIVE_SPEED]);
@@ -437,6 +443,7 @@ void
option_gui_set_up_window(void)
{
gint i;
+ gchar buf[SMALL];
GtkToggleButton *bool_widgets[BOOL_OPT_END];
gint *bool_options[BOOL_OPT_END];
@@ -447,6 +454,7 @@ option_gui_set_up_window(void)
gchar **entry_options[ENTRY_OPT_END];
treeview_show_language_combo();
+ treeview_show_training_hotels_combo();
option_gui_write_bool_widgets(bool_options, bool_widgets);
option_gui_write_spin_widgets(spin_options, spin_widgets);
@@ -460,6 +468,10 @@ option_gui_set_up_window(void)
for(i=0;iname,
league_cup_get_name_string(usr(i).tm->clid),
buf, NULL);
+
+ usr(i).counters[COUNT_USER_TRAININGS_LEFT_SEASON] =
+ const_int("int_training_camps_per_season");
}
start_new_season_league_changes();
diff --git a/src/training_callbacks.c b/src/training_callbacks.c
index 5c89726a..65e41453 100755
--- a/src/training_callbacks.c
+++ b/src/training_callbacks.c
@@ -63,18 +63,22 @@ on_b_ok_clicked (GtkButton *button,
gdouble value_training;
gdouble value_recreation;
gint number_camp;
+ gboolean save;
Team *current_team = current_user.tm;
-
+
+ save = gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(lookup_widget(window.training_camp, "checkbutton_save")));
+
//Get active radio
rb_camp1 = GTK_WIDGET(lookup_widget(window.training_camp, "rb_camp1"));
rb_camp2 = GTK_WIDGET(lookup_widget(window.training_camp, "rb_camp2"));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rb_camp1)))
- number_camp = 1;
+ number_camp = TRAINING_CAMP_HOTEL_GOOD;
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(rb_camp2)))
- number_camp = 2;
+ number_camp = TRAINING_CAMP_HOTEL_FIRST;
else
- number_camp = 3;
+ number_camp = TRAINING_CAMP_HOTEL_PREMIUM;
//Get values for training and recreation
hs_recreation = GTK_HSCALE(lookup_widget(window.training_camp, "hs_recreation"));
@@ -96,8 +100,19 @@ on_b_ok_clicked (GtkButton *button,
//Set new av-values -> GUI
game_gui_write_money();
+
+ if(save)
+ {
+ opt_user_set_int("int_opt_user_training_camp_hotel", number_camp);
+ opt_user_set_int("int_opt_user_training_camp_recreation", value_recreation);
+ }
window_destroy(&window.training_camp);
+
+ current_user.counters[COUNT_USER_TRAININGS_WEEK]++;
+ current_user.counters[COUNT_USER_TRAININGS_LEFT_SEASON]--;
+ game_gui_print_message(_("%d training camps left this season."),
+ current_user.counters[COUNT_USER_TRAININGS_LEFT_SEASON]);
}
void
diff --git a/src/training_interface.c b/src/training_interface.c
index 95317463..1e59cc71 100755
--- a/src/training_interface.c
+++ b/src/training_interface.c
@@ -32,18 +32,12 @@ create_window_training_camp (void)
GtkWidget *window_training_camp;
GtkWidget *panel_camp;
GtkWidget *tf_costs;
- GtkWidget *hs_camp1;
- GtkWidget *b_cancel;
- GtkWidget *b_ok;
GtkWidget *hs_camp2;
GtkWidget *l_camp_points;
GtkWidget *b_inc_recreation;
GtkWidget *image2;
GtkWidget *l_recreation;
GtkWidget *l_costs;
- GtkWidget *rb_camp2;
- GSList *rb_camp2_group = NULL;
- GtkWidget *rb_camp3;
GtkWidget *b_dec_training;
GtkWidget *image3;
GtkWidget *l_training;
@@ -53,8 +47,15 @@ create_window_training_camp (void)
GtkWidget *hs_training;
GtkWidget *b_dec_recreation;
GtkWidget *image1;
- GtkWidget *rb_camp1;
GtkWidget *hs_recreation;
+ GtkWidget *rb_camp1;
+ GSList *rb_camp1_group = NULL;
+ GtkWidget *rb_camp2;
+ GtkWidget *rb_camp3;
+ GtkWidget *hs_camp1;
+ GtkWidget *b_ok;
+ GtkWidget *b_cancel;
+ GtkWidget *checkbutton_save;
window_training_camp = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window_training_camp), _("Training camp"));
@@ -76,21 +77,6 @@ create_window_training_camp (void)
gtk_entry_set_has_frame (GTK_ENTRY (tf_costs), FALSE);
gtk_entry_set_invisible_char (GTK_ENTRY (tf_costs), 9679);
- hs_camp1 = gtk_hseparator_new ();
- gtk_widget_show (hs_camp1);
- gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp1, 25, 235);
- gtk_widget_set_size_request (hs_camp1, 450, 16);
-
- b_cancel = gtk_button_new_from_stock ("gtk-cancel");
- gtk_widget_show (b_cancel);
- gtk_fixed_put (GTK_FIXED (panel_camp), b_cancel, 376, 254);
- gtk_widget_set_size_request (b_cancel, 110, 25);
-
- b_ok = gtk_button_new_from_stock ("gtk-apply");
- gtk_widget_show (b_ok);
- gtk_fixed_put (GTK_FIXED (panel_camp), b_ok, 256, 254);
- gtk_widget_set_size_request (b_ok, 110, 25);
-
hs_camp2 = gtk_hseparator_new ();
gtk_widget_show (hs_camp2);
gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp2, 25, 90);
@@ -120,20 +106,6 @@ create_window_training_camp (void)
gtk_fixed_put (GTK_FIXED (panel_camp), l_costs, 255, 41);
gtk_widget_set_size_request (l_costs, 90, 20);
- rb_camp2 = gtk_radio_button_new_with_mnemonic (NULL, _("First-Class Hotel"));
- gtk_widget_show (rb_camp2);
- gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp2, 24, 40);
- gtk_widget_set_size_request (rb_camp2, 200, 21);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp2), rb_camp2_group);
- rb_camp2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp2));
-
- rb_camp3 = gtk_radio_button_new_with_mnemonic (NULL, _("Premium Hotel"));
- gtk_widget_show (rb_camp3);
- gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp3, 24, 64);
- gtk_widget_set_size_request (rb_camp3, 200, 21);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp3), rb_camp2_group);
- rb_camp2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp3));
-
b_dec_training = gtk_button_new ();
gtk_widget_show (b_dec_training);
gtk_fixed_put (GTK_FIXED (panel_camp), b_dec_training, 176, 157);
@@ -180,13 +152,6 @@ create_window_training_camp (void)
gtk_widget_show (image1);
gtk_container_add (GTK_CONTAINER (b_dec_recreation), image1);
- rb_camp1 = gtk_radio_button_new_with_mnemonic (NULL, _("Good Hotel"));
- gtk_widget_show (rb_camp1);
- gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp1, 24, 16);
- gtk_widget_set_size_request (rb_camp1, 200, 21);
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp1), rb_camp2_group);
- rb_camp2_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp1));
-
hs_recreation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 1, 10, 1, 0, 0)));
gtk_widget_show (hs_recreation);
gtk_fixed_put (GTK_FIXED (panel_camp), hs_recreation, 220, 120);
@@ -194,24 +159,53 @@ create_window_training_camp (void)
GTK_WIDGET_UNSET_FLAGS (hs_recreation, GTK_CAN_FOCUS);
gtk_scale_set_value_pos (GTK_SCALE (hs_recreation), GTK_POS_RIGHT);
+ rb_camp1 = gtk_radio_button_new_with_mnemonic (NULL, _("Good Hotel"));
+ gtk_widget_show (rb_camp1);
+ gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp1, 24, 16);
+ gtk_widget_set_size_request (rb_camp1, 200, 21);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp1), rb_camp1_group);
+ rb_camp1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp1));
+
+ rb_camp2 = gtk_radio_button_new_with_mnemonic (NULL, _("First-Class Hotel"));
+ gtk_widget_show (rb_camp2);
+ gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp2, 24, 40);
+ gtk_widget_set_size_request (rb_camp2, 200, 21);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp2), rb_camp1_group);
+ rb_camp1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp2));
+
+ rb_camp3 = gtk_radio_button_new_with_mnemonic (NULL, _("Premium Hotel"));
+ gtk_widget_show (rb_camp3);
+ gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp3, 24, 64);
+ gtk_widget_set_size_request (rb_camp3, 200, 21);
+ gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp3), rb_camp1_group);
+ rb_camp1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp3));
+
+ hs_camp1 = gtk_hseparator_new ();
+ gtk_widget_show (hs_camp1);
+ gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp1, 25, 232);
+ gtk_widget_set_size_request (hs_camp1, 450, 16);
+
+ b_ok = gtk_button_new_from_stock ("gtk-apply");
+ gtk_widget_show (b_ok);
+ gtk_fixed_put (GTK_FIXED (panel_camp), b_ok, 256, 254);
+ gtk_widget_set_size_request (b_ok, 110, 35);
+
+ b_cancel = gtk_button_new_from_stock ("gtk-cancel");
+ gtk_widget_show (b_cancel);
+ gtk_fixed_put (GTK_FIXED (panel_camp), b_cancel, 376, 254);
+ gtk_widget_set_size_request (b_cancel, 110, 35);
+
+ checkbutton_save = gtk_check_button_new_with_mnemonic (_("Save settings as default"));
+ gtk_widget_show (checkbutton_save);
+ gtk_fixed_put (GTK_FIXED (panel_camp), checkbutton_save, 24, 264);
+ gtk_widget_set_size_request (checkbutton_save, 208, 21);
+
g_signal_connect ((gpointer) window_training_camp, "delete_event",
G_CALLBACK (on_window_training_camp_delete_event),
NULL);
- g_signal_connect ((gpointer) b_cancel, "clicked",
- G_CALLBACK (on_b_cancel_clicked),
- NULL);
- g_signal_connect ((gpointer) b_ok, "clicked",
- G_CALLBACK (on_b_ok_clicked),
- NULL);
g_signal_connect ((gpointer) b_inc_recreation, "clicked",
G_CALLBACK (on_b_inc_recreation_clicked),
NULL);
- g_signal_connect ((gpointer) rb_camp2, "clicked",
- G_CALLBACK (on_rb_camp2_clicked),
- NULL);
- g_signal_connect ((gpointer) rb_camp3, "clicked",
- G_CALLBACK (on_rb_camp3_clicked),
- NULL);
g_signal_connect ((gpointer) b_dec_training, "clicked",
G_CALLBACK (on_b_dec_training_clicked),
NULL);
@@ -224,22 +218,29 @@ create_window_training_camp (void)
g_signal_connect ((gpointer) rb_camp1, "clicked",
G_CALLBACK (on_rb_camp1_clicked),
NULL);
+ g_signal_connect ((gpointer) rb_camp2, "clicked",
+ G_CALLBACK (on_rb_camp2_clicked),
+ NULL);
+ g_signal_connect ((gpointer) rb_camp3, "clicked",
+ G_CALLBACK (on_rb_camp3_clicked),
+ NULL);
+ g_signal_connect ((gpointer) b_ok, "clicked",
+ G_CALLBACK (on_b_ok_clicked),
+ NULL);
+ g_signal_connect ((gpointer) b_cancel, "clicked",
+ G_CALLBACK (on_b_cancel_clicked),
+ NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (window_training_camp, window_training_camp, "window_training_camp");
GLADE_HOOKUP_OBJECT (window_training_camp, panel_camp, "panel_camp");
GLADE_HOOKUP_OBJECT (window_training_camp, tf_costs, "tf_costs");
- GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp1, "hs_camp1");
- GLADE_HOOKUP_OBJECT (window_training_camp, b_cancel, "b_cancel");
- GLADE_HOOKUP_OBJECT (window_training_camp, b_ok, "b_ok");
GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp2, "hs_camp2");
GLADE_HOOKUP_OBJECT (window_training_camp, l_camp_points, "l_camp_points");
GLADE_HOOKUP_OBJECT (window_training_camp, b_inc_recreation, "b_inc_recreation");
GLADE_HOOKUP_OBJECT (window_training_camp, image2, "image2");
GLADE_HOOKUP_OBJECT (window_training_camp, l_recreation, "l_recreation");
GLADE_HOOKUP_OBJECT (window_training_camp, l_costs, "l_costs");
- GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp2, "rb_camp2");
- GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp3, "rb_camp3");
GLADE_HOOKUP_OBJECT (window_training_camp, b_dec_training, "b_dec_training");
GLADE_HOOKUP_OBJECT (window_training_camp, image3, "image3");
GLADE_HOOKUP_OBJECT (window_training_camp, l_training, "l_training");
@@ -249,8 +250,14 @@ create_window_training_camp (void)
GLADE_HOOKUP_OBJECT (window_training_camp, hs_training, "hs_training");
GLADE_HOOKUP_OBJECT (window_training_camp, b_dec_recreation, "b_dec_recreation");
GLADE_HOOKUP_OBJECT (window_training_camp, image1, "image1");
- GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp1, "rb_camp1");
GLADE_HOOKUP_OBJECT (window_training_camp, hs_recreation, "hs_recreation");
+ GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp1, "rb_camp1");
+ GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp2, "rb_camp2");
+ GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp3, "rb_camp3");
+ GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp1, "hs_camp1");
+ GLADE_HOOKUP_OBJECT (window_training_camp, b_ok, "b_ok");
+ GLADE_HOOKUP_OBJECT (window_training_camp, b_cancel, "b_cancel");
+ GLADE_HOOKUP_OBJECT (window_training_camp, checkbutton_save, "checkbutton_save");
gtk_widget_grab_focus (rb_camp1);
return window_training_camp;
diff --git a/src/training_struct.h b/src/training_struct.h
index cfac741a..d4a08a67 100755
--- a/src/training_struct.h
+++ b/src/training_struct.h
@@ -32,4 +32,12 @@
#define CAMP_SCALE_MAX 10
#define CAMP_SCALE_STEP 1
+enum TrainingCampHotel
+{
+ TRAINING_CAMP_HOTEL_GOOD = 1,
+ TRAINING_CAMP_HOTEL_FIRST,
+ TRAINING_CAMP_HOTEL_PREMIUM,
+ TRAINING_CAMP_HOTEL_END
+};
+
#endif
diff --git a/src/treeview.c b/src/treeview.c
index 198bfc34..fd5572ca 100644
--- a/src/treeview.c
+++ b/src/treeview.c
@@ -2551,6 +2551,46 @@ treeview_show_language_combo(void)
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_languages), idx + 1);
}
+GtkTreeModel*
+treeview_create_training_hotel_list(void)
+{
+ GtkListStore *ls = gtk_list_store_new(1, G_TYPE_STRING);
+ GtkTreeIter iter;
+
+ gtk_list_store_append(ls, &iter);
+ gtk_list_store_set(ls, &iter, 0, _("Good Hotel"), -1);
+
+ gtk_list_store_append(ls, &iter);
+ gtk_list_store_set(ls, &iter, 0, _("First-Class Hotel"), -1);
+
+ gtk_list_store_append(ls, &iter);
+ gtk_list_store_set(ls, &iter, 0, _("Premium Hotel"), -1);
+
+ return GTK_TREE_MODEL(ls);
+}
+
+/** Show the list of training camp hotels. */
+void
+treeview_show_training_hotels_combo(void)
+{
+ GtkTreeModel *model = treeview_create_training_hotel_list();
+ GtkComboBox *combo_hotel =
+ GTK_COMBO_BOX(lookup_widget(window.options, "combobox_hotel"));
+ GtkCellRenderer *renderer = NULL;
+
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(combo_hotel));
+
+ renderer = treeview_helper_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo_hotel), renderer, FALSE);
+ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_hotel), renderer, "text", 0, NULL);
+
+ gtk_combo_box_set_model(combo_hotel, model);
+ g_object_unref(model);
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo_hotel),
+ opt_user_int("int_opt_user_training_camp_hotel") - 1);
+}
+
GtkTreeModel*
treeview_create_sponsors(const GArray *sponsors)
{
diff --git a/src/treeview.h b/src/treeview.h
index d57f90f0..d5dbff2c 100644
--- a/src/treeview.h
+++ b/src/treeview.h
@@ -241,4 +241,10 @@ treeview_set_up_sponsors(GtkTreeView *treeview);
void
treeview_show_sponsors(const GArray *sponsors);
+GtkTreeModel*
+treeview_create_training_hotel_list(void);
+
+void
+treeview_show_training_hotels_combo(void);
+
#endif
diff --git a/src/user.c b/src/user.c
index 1bdc8f27..aa534234 100644
--- a/src/user.c
+++ b/src/user.c
@@ -174,6 +174,8 @@ user_set_up_counters(User *user)
user->counters[COUNT_USER_LOAN] =
user->counters[COUNT_USER_POSITIVE] = -1;
+ user->counters[COUNT_USER_TRAININGS_LEFT_SEASON] =
+ const_int("int_training_camps_per_season");
}
/** Set up the user's finances when he's got a new team.
@@ -354,6 +356,8 @@ user_weekly_update_counters(User *user)
gint increase_capacity;
gfloat increase_safety;
+ cnts[COUNT_USER_TRAININGS_WEEK] = 0;
+
if(cnts[COUNT_USER_STADIUM_CAPACITY] > 0)
{
increase_capacity = math_rndi(const_int("int_stadium_improvement_base_seats") -
diff --git a/src/user_struct.h b/src/user_struct.h
index cfe09be9..1a81b94b 100644
--- a/src/user_struct.h
+++ b/src/user_struct.h
@@ -80,6 +80,8 @@ enum CounterValue
COUNT_USER_SHOW_RES, /**< Whether the latest result is shown when the main window gets refreshed. */
COUNT_USER_TOOK_TURN, /**< Whether the user took his turn in a week round. */
COUNT_USER_NEW_SPONSOR, /**< A new sponsor offer has to be shown. */
+ COUNT_USER_TRAININGS_WEEK, /**< Whether the user has already had a training camp this week. */
+ COUNT_USER_TRAININGS_LEFT_SEASON, /**< How many training camps left for the season. */
COUNT_USER_END
};
diff --git a/src/window.c b/src/window.c
index 0c1c4bee..2fd0f129 100644
--- a/src/window.c
+++ b/src/window.c
@@ -952,7 +952,13 @@ window_show_training_camp(void)
rb_camp1 = GTK_WIDGET(lookup_widget(window.training_camp, "rb_camp1"));
rb_camp2 = GTK_WIDGET(lookup_widget(window.training_camp, "rb_camp2"));
rb_camp3 = GTK_WIDGET(lookup_widget(window.training_camp, "rb_camp3"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_camp1), TRUE);
+
+ if(opt_user_int("int_opt_user_training_camp_hotel") == TRAINING_CAMP_HOTEL_GOOD)
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_camp1), TRUE);
+ else if(opt_user_int("int_opt_user_training_camp_hotel") == TRAINING_CAMP_HOTEL_FIRST)
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_camp2), TRUE);
+ else
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rb_camp3), TRUE);
//Initialize labels
l_costs = GTK_LABEL(lookup_widget(window.training_camp, "l_costs"));
@@ -971,9 +977,10 @@ window_show_training_camp(void)
gtk_range_set_range (GTK_RANGE(hs_recreation), CAMP_SCALE_MIN, CAMP_SCALE_MAX);
gtk_range_set_range (GTK_RANGE(hs_training), CAMP_SCALE_MIN, CAMP_SCALE_MAX);
gtk_range_set_range (GTK_RANGE(hs_camp_points), CAMP_SCALE_MIN, CAMP_SCALE_MAX);
- gtk_range_set_value (GTK_RANGE(hs_recreation), CAMP_SCALE_MIN);
- gtk_range_set_value (GTK_RANGE(hs_training), CAMP_SCALE_MIN);
- gtk_range_set_value (GTK_RANGE(hs_camp_points), CAMP_SCALE_MAX);
+ gtk_range_set_value (GTK_RANGE(hs_recreation), opt_user_int("int_opt_user_training_camp_recreation"));
+ gtk_range_set_value (GTK_RANGE(hs_training),
+ CAMP_SCALE_MAX - opt_user_int("int_opt_user_training_camp_recreation"));
+ gtk_range_set_value (GTK_RANGE(hs_camp_points), CAMP_SCALE_MIN);
gtk_scale_set_digits (GTK_SCALE(hs_recreation), 0);
gtk_scale_set_digits (GTK_SCALE(hs_training), 0);
gtk_scale_set_digits (GTK_SCALE(hs_camp_points), 0);
diff --git a/support_files/bygfoot_constants b/support_files/bygfoot_constants
index 65381af0..68a0a35e 100644
--- a/support_files/bygfoot_constants
+++ b/support_files/bygfoot_constants
@@ -229,7 +229,6 @@ int_treeview_max_pipes 50
float_player_pos_bound1 37550
float_player_pos_bound2 75100
-
# minimum number of players in a user team.
int_team_min_players 11
# maximum number of players in a user team.
@@ -981,3 +980,9 @@ float_transfer_star_goalie_accepts 12000
float_training_camp_factor1 500000
float_training_camp_factor2 1000000
float_training_camp_factor3 1500000
+
+# number of training camps allowed for one season
+int_training_camps_per_season 12
+
+# number of training camps allowed per week
+int_training_camps_week 2
diff --git a/support_files/bygfoot_user.conf b/support_files/bygfoot_user.conf
index 0e8dfe4d..88dbec7a 100644
--- a/support_files/bygfoot_user.conf
+++ b/support_files/bygfoot_user.conf
@@ -27,6 +27,10 @@ int_opt_user_bet_show_cups 1
int_opt_user_bet_show_my_recent 1
int_opt_user_bet_default_wager 5000
+# default training camp hotel
+int_opt_user_training_camp_hotel 1
+int_opt_user_training_camp_recreation 5
+
# the order of these attributes is important
# don't change it, only the values
int_opt_user_pl1_att_name 1