From 922d270910704049c8fb5af6089fe7e4d909b84b Mon Sep 17 00:00:00 2001 From: gunnar_g Date: Tue, 3 Mar 2009 22:23:37 +0000 Subject: [PATCH] Solving valgrind errors. Player->peak_region was not yet defined before being used. --- src/youth_academy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/youth_academy.c b/src/youth_academy.c index 45c6994c..8eea2020 100644 --- a/src/youth_academy.c +++ b/src/youth_academy.c @@ -141,6 +141,10 @@ youth_academy_add_new_player(YouthAcademy *youth_academy) percentage_coach_talent_factor * av_talent * (1 + const_float("float_youth_academy_talent_variance"))); + new.peak_region = + math_gauss_dist(const_float("float_player_peak_region_lower"), + const_float("float_player_peak_region_upper"));//2; + new.talent = CLAMP(new.talent, 0, const_float("float_player_max_skill")); new.skill = player_skill_from_talent(&new); new.cskill = new.skill; @@ -168,10 +172,6 @@ youth_academy_add_new_player(YouthAcademy *youth_academy) new.streak = PLAYER_STREAK_NONE; new.streak_count = new.streak_prob = 0; - new.peak_region = - math_gauss_dist(const_float("float_player_peak_region_lower"), - const_float("float_player_peak_region_upper"));//2; - g_array_append_val(youth_academy->players, new); }