diff --git a/bygfoot_misc.glade b/bygfoot_misc.glade
index 5658c966..903ada5e 100644
--- a/bygfoot_misc.glade
+++ b/bygfoot_misc.glade
@@ -2071,7 +2071,7 @@
GTK_UPDATE_ALWAYS
False
False
- 1 0 100 0.00999999977648 10 10
+ 1 0 100 0.10000000149 10 10
1
diff --git a/src/finance.c b/src/finance.c
index 872a6ec7..d3e350e8 100644
--- a/src/finance.c
+++ b/src/finance.c
@@ -322,10 +322,10 @@ finance_assign_game_money(const Fixture *fix)
! g_array_index(cup_from_clid(fix->clid)->rounds, CupRound, fix->round).home_away)
{
ticket_income[0] =
- ticket_income[1] = fix->attendance * const_int("int_team_stadium_ticket_price") / 2;
+ ticket_income[1] = fix->attendance * fix->teams[0]->stadium.ticket_price / 2;
}
else
- ticket_income[0] = fix->attendance * const_int("int_team_stadium_ticket_price");
+ ticket_income[0] = fix->attendance * fix->teams[0]->stadium.ticket_price;
for(i = 0; i < 2; i++)
{
diff --git a/src/game.c b/src/game.c
index 6032986c..991594aa 100644
--- a/src/game.c
+++ b/src/game.c
@@ -335,9 +335,8 @@ game_assign_attendance(Fixture *fix)
powf(tm[0]->stadium.safety,
const_float("float_game_stadium_attendance_safety_exponent"));
/* calculate the differnce in ticket prices has on attendance */
- /* TODO: Make the factor 0.125 a constant*/
gfloat delta_price = tm[0]->stadium.ticket_price - const_int("int_team_stadium_ticket_price");
- gfloat price_factor = 1/(1+0.125*delta_price);
+ gfloat price_factor = 1/(1+const_float("float_team_stadium_price_attendance_factor")*delta_price);
gint max_att = MIN((gint)rint((gfloat)league_cup_average_capacity(tm[0]->clid) *
const_float("float_game_stadium_attendance_average_exceed_factor") *
math_rnd(0.9, 1.1)*price_factor),
diff --git a/src/misc_interface.c b/src/misc_interface.c
index b9847e0e..0ba3fb45 100644
--- a/src/misc_interface.c
+++ b/src/misc_interface.c
@@ -1004,7 +1004,7 @@ 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, 0.00999999977648, 10, 10);
+ spin_ticket_price_adj = gtk_adjustment_new (1, 0, 100, 0.10000000149, 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,
diff --git a/src/user.c b/src/user.c
index 0f794a2f..973e6a35 100644
--- a/src/user.c
+++ b/src/user.c
@@ -571,6 +571,9 @@ user_change_team(User *user, Team *tm)
gint i;
gint success = user->counters[COUNT_USER_SUCCESS];
+ /* Reset the ticketprice of the old team to the default value */
+ user->tm->stadium.ticket_price = const_int("int_team_stadium_ticket_price");
+
user->tm = tm;
user->team_id = tm->id;
diff --git a/src/window.c b/src/window.c
index 275489e9..0b0413d8 100644
--- a/src/window.c
+++ b/src/window.c
@@ -521,6 +521,11 @@ window_show_stadium(void)
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);
+ /* Set the lower bound to constant_ticket_price-(1/constant_ticket_attendance)
+ +1 So that we can't divide by 0 or negative numbers*/
+ gfloat lower_bound = const_int("int_team_stadium_ticket_price")-(1/const_float("float_team_stadium_price_attendance_factor"))+1;
+
+ gtk_spin_button_set_range(spin_ticket_price, lower_bound, 100);
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/support_files/bygfoot_constants b/support_files/bygfoot_constants
index 0ebfd7aa..091430dd 100644
--- a/support_files/bygfoot_constants
+++ b/support_files/bygfoot_constants
@@ -96,9 +96,14 @@ float_team_stadium_safety_upper 100000
# ticket price; this determines together with
# the player wages the size of the stadium at
-# generation
+# generation. It's also used inattendance
+# calculation
int_team_stadium_ticket_price 25
+# price vs attendace. This determines together
+# with the prices gow high the attedace will be
+float_team_stadium_price_attendance_factor 12500
+
# factor for stadium size; this determines the income
# of the user teams
float_team_stadium_size_wage_factor 180000