The implmentation was flawed. Moved the code further down to the correct place and tweaked the formula

This commit is contained in:
gunnar_g 2008-10-31 14:00:48 +00:00
parent 36683a3a0d
commit 60c8fd4b09
2 changed files with 7 additions and 6 deletions

View File

@ -334,12 +334,9 @@ game_assign_attendance(Fixture *fix)
const_float("float_game_stadium_attendance_percentage_upper")) * const_float("float_game_stadium_attendance_percentage_upper")) *
powf(tm[0]->stadium.safety, powf(tm[0]->stadium.safety,
const_float("float_game_stadium_attendance_safety_exponent")); const_float("float_game_stadium_attendance_safety_exponent"));
/* calculate the differnce in ticket prices has on attendance */
gfloat delta_price = tm[0]->stadium.ticket_price - const_int("int_team_stadium_ticket_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) * gint max_att = MIN((gint)rint((gfloat)league_cup_average_capacity(tm[0]->clid) *
const_float("float_game_stadium_attendance_average_exceed_factor") * const_float("float_game_stadium_attendance_average_exceed_factor") *
math_rnd(0.9, 1.1)*price_factor), math_rnd(0.9, 1.1)),
tm[0]->stadium.capacity); tm[0]->stadium.capacity);
if(fix->clid < ID_CUP_START && if(fix->clid < ID_CUP_START &&
@ -359,7 +356,11 @@ game_assign_attendance(Fixture *fix)
factor *= const_float("float_game_stadium_attendance_cup_international_factor"); factor *= const_float("float_game_stadium_attendance_cup_international_factor");
} }
factor = MIN(factor, 1); /* calculate the differnce in ticket prices has on attendance */
gfloat delta_price = tm[0]->stadium.ticket_price - const_int("int_team_stadium_ticket_price");
gfloat price_factor = math_gauss_dist(0.92, 1.08) * 1/(1+const_float("float_team_stadium_price_attendance_factor")*delta_price);
factor = MIN(factor * price_factor, 1);
fix->attendance = MIN(MIN((gint)rint((gfloat)tm[0]->stadium.capacity * factor), fix->attendance = MIN(MIN((gint)rint((gfloat)tm[0]->stadium.capacity * factor),
max_att * factor), max_att); max_att * factor), max_att);

View File

@ -102,7 +102,7 @@ int_team_stadium_ticket_price 25
# price vs attendace. This determines together # price vs attendace. This determines together
# with the prices gow high the attedace will be # with the prices gow high the attedace will be
float_team_stadium_price_attendance_factor 12500 float_team_stadium_price_attendance_factor 5000
# factor for stadium size; this determines the income # factor for stadium size; this determines the income
# of the user teams # of the user teams