diff --git a/bygfoot_misc.glade b/bygfoot_misc.glade
index f1fa08be..5f9f8351 100644
--- a/bygfoot_misc.glade
+++ b/bygfoot_misc.glade
@@ -2067,11 +2067,11 @@
True
1
2
- False
+ True
GTK_UPDATE_ALWAYS
False
False
- 1 0 100 1 10 10
+ 1 0 100 0.00999999977648 10 10
1
diff --git a/src/misc_callback_func.c b/src/misc_callback_func.c
index 8c591df8..b92122c2 100644
--- a/src/misc_callback_func.c
+++ b/src/misc_callback_func.c
@@ -260,7 +260,10 @@ misc_callback_improve_stadium(void)
GtkSpinButton *spinbutton_capacity =
GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spinbutton_capacity")),
*spinbutton_safety =
- GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spinbutton_safety"));
+ GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spinbutton_safety")),
+ *spinbutton_ticket_price =
+ GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spin_ticket_price"));
+ gfloat ticket_price = gtk_spin_button_get_value(spinbutton_ticket_price);
gint value_capacity = gtk_spin_button_get_value_as_int(spinbutton_capacity),
value_safety = gtk_spin_button_get_value_as_int(spinbutton_safety);
gint cost_capacity, cost_safety;
@@ -282,6 +285,8 @@ misc_callback_improve_stadium(void)
return;
}
+ current_user.tm->stadium.ticket_price = ticket_price;
+
current_user.money -= (cost_capacity + cost_safety);
current_user.money_out[1][MON_OUT_STADIUM_IMPROVEMENT] -= (cost_safety + cost_capacity);
diff --git a/src/misc_interface.c b/src/misc_interface.c
index 85d46f3d..6d56c7e2 100644
--- a/src/misc_interface.c
+++ b/src/misc_interface.c
@@ -1004,12 +1004,13 @@ create_window_stadium (void)
gtk_table_set_row_spacings (GTK_TABLE (table3), 3);
gtk_table_set_col_spacings (GTK_TABLE (table3), 3);
- spin_ticket_price_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
+ spin_ticket_price_adj = gtk_adjustment_new (1, 0, 100, 0.00999999977648, 10, 10);
spin_ticket_price = gtk_spin_button_new (GTK_ADJUSTMENT (spin_ticket_price_adj), 1, 2);
gtk_widget_show (spin_ticket_price);
gtk_table_attach (GTK_TABLE (table3), spin_ticket_price, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
+ gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_ticket_price), TRUE);
label124 = gtk_label_new (_("Change ticket price"));
gtk_widget_show (label124);
diff --git a/src/team.c b/src/team.c
index 9a508e36..17215e2f 100644
--- a/src/team.c
+++ b/src/team.c
@@ -64,6 +64,8 @@ team_new(gboolean new_id)
new.average_talent = 0;
new.luck = 1;
+ new.stadium.ticket_price = const_int("int_team_stadium_ticket_price");
+
new.players = g_array_new(FALSE, FALSE, sizeof(Player));
return new;
diff --git a/src/team_struct.h b/src/team_struct.h
index 3d480b95..e8c9823b 100644
--- a/src/team_struct.h
+++ b/src/team_struct.h
@@ -65,6 +65,7 @@ typedef struct
of the capacity. Default: 0. */
games; /**< Number of games. Default: 0. */
gfloat safety; /**< Safety percentage between 0 and 100. Default: randomized. */
+ gfloat ticket_price;
} Stadium;
diff --git a/src/user.c b/src/user.c
index f0eda8dd..0f794a2f 100644
--- a/src/user.c
+++ b/src/user.c
@@ -76,7 +76,6 @@ user_new(void)
new.bets[0] = g_array_new(FALSE, FALSE, sizeof(BetUser));
new.bets[1] = g_array_new(FALSE, FALSE, sizeof(BetUser));
- new.ticket_price = const_int("int_team_stadium_ticket_price");
return new;
}
diff --git a/src/user_struct.h b/src/user_struct.h
index dfa6ed91..1a81b94b 100644
--- a/src/user_struct.h
+++ b/src/user_struct.h
@@ -164,7 +164,7 @@ typedef struct
/** The user's money, debt, income and expenses.
We have double arrays to store information about
the current and the past week. */
- gint ticket_price, money, debt, money_in[2][MON_IN_END],
+ gint money, debt, money_in[2][MON_IN_END],
money_out[2][MON_OUT_END];
/** The user's scout and physio qualities.
@see #Quality */
diff --git a/src/window.c b/src/window.c
index 7519662c..275489e9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -510,7 +510,7 @@ window_show_stadium(void)
GtkProgressBar *progressbar_safety,
*progressbar_average_attendance;
gfloat average_attendance_perc = 0;
- GtkSpinButton *spinbutton_ticket_price;
+ GtkSpinButton *spin_ticket_price;
window_create(WINDOW_STADIUM);
@@ -519,8 +519,8 @@ window_show_stadium(void)
label_average_attendance = GTK_LABEL(lookup_widget(window.stadium, "label_average_attendance"));
label_name = GTK_LABEL(lookup_widget(window.stadium, "label_stadium_name"));
- spinbutton_ticket_price = GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spin_ticket_price"));
- gtk_spin_button_set_value(spinbutton_ticket_price, current_user.ticket_price);
+ spin_ticket_price = GTK_SPIN_BUTTON(lookup_widget(window.stadium, "spin_ticket_price"));
+ gtk_spin_button_set_value(spin_ticket_price, tm->stadium.ticket_price);
progressbar_safety = GTK_PROGRESS_BAR(lookup_widget(window.stadium, "progressbar_safety"));
progressbar_average_attendance = GTK_PROGRESS_BAR(lookup_widget(window.stadium, "progressbar_average_attendance"));
diff --git a/src/xml_loadsave_teams.c b/src/xml_loadsave_teams.c
index 685a135d..248da7e3 100644
--- a/src/xml_loadsave_teams.c
+++ b/src/xml_loadsave_teams.c
@@ -49,6 +49,7 @@ enum
TAG_TEAM_STADIUM_GAMES,
TAG_TEAM_STADIUM_SAFETY,
TAG_TEAM_LUCK,
+ TAG_TEAM_STADIUM_TICKET_PRICE,
TAG_END
};
@@ -129,6 +130,7 @@ xml_loadsave_teams_end_element (GMarkupParseContext *context,
tag == TAG_TEAM_STADIUM_AVERAGE_ATTENDANCE ||
tag == TAG_TEAM_STADIUM_POSSIBLE_ATTENDANCE ||
tag == TAG_TEAM_STADIUM_GAMES ||
+ tag == TAG_TEAM_STADIUM_TICKET_PRICE ||
tag == TAG_TEAM_STADIUM_SAFETY)
state = TAG_TEAM_STADIUM;
else if(tag >= TAG_START_PLAYERS && tag <= TAG_END_PLAYERS)
@@ -189,6 +191,8 @@ xml_loadsave_teams_text (GMarkupParseContext *context,
new_team.stadium.games = int_value;
else if(state == TAG_TEAM_STADIUM_SAFETY)
new_team.stadium.safety = float_value;
+ else if(state == TAG_TEAM_STADIUM_TICKET_PRICE)
+ new_team.stadium.ticket_price = float_value;
else if(state == TAG_TEAM_LUCK)
new_team.luck = float_value;
else if(state >= TAG_START_PLAYERS && state <= TAG_END_PLAYERS)
@@ -279,6 +283,7 @@ xml_loadsave_teams_write_team(FILE *fil, const Team* team)
xml_write_int(fil, team->stadium.possible_attendance, TAG_TEAM_STADIUM_POSSIBLE_ATTENDANCE, I2);
xml_write_int(fil, team->stadium.games, TAG_TEAM_STADIUM_GAMES, I2);
xml_write_float(fil, team->stadium.safety, TAG_TEAM_STADIUM_SAFETY, I2);
+ xml_write_float(fil, team->stadium.ticket_price, TAG_TEAM_STADIUM_TICKET_PRICE, I2);
fprintf(fil, "%s\n", I1, TAG_TEAM_STADIUM);