Added talents from leagues to cup definitions.

This commit is contained in:
gyboth 2008-11-18 13:26:57 +00:00
parent 0a003db805
commit 17c27788a9
2 changed files with 18 additions and 6 deletions

View File

@ -461,9 +461,17 @@ cup_load_choose_team_generate(Cup *cup, CupRound *cup_round, const CupChooseTeam
xml_league_read((gchar*)g_ptr_array_index(sids, j), leagues);
for(k=0; k < g_array_index(leagues, League, leagues->len - 1).teams->len; k++)
g_array_append_val(teams_local, g_array_index(
g_array_index(leagues, League, leagues->len - 1).teams, Team, k));
{
if(query_cup_has_property(cup->id, "league_talents"))
{
g_array_index(
g_array_index(leagues, League, leagues->len - 1).teams, Team, k).average_talent =
g_array_index(leagues, League, leagues->len - 1).average_talent;
}
g_array_append_val(teams_local, g_array_index(
g_array_index(leagues, League, leagues->len - 1).teams, Team, k));
}
free_g_array(&g_array_index(leagues, League, leagues->len - 1).teams);
free_league(&g_array_index(leagues, League, leagues->len - 1));
}

View File

@ -100,9 +100,13 @@ team_generate_players_stadium(Team *tm, gfloat av_talent)
tm->average_talent;
}
else
average_talent =
skill_factor * team_get_average_talents(lig(0).teams) *
(1 + cup_from_clid(tm->clid)->talent_diff);
{
average_talent = (tm->average_talent == 0) ?
team_get_average_talents(lig(0).teams) *
(1 + cup_from_clid(tm->clid)->talent_diff) :
tm->average_talent;
average_talent *= skill_factor;
}
average_talent = CLAMP(average_talent, 0, const_float("float_player_max_skill"));
tm->average_talent = average_talent;