mirror of https://github.com/tstellar/bygfoot.git
Refactor team_get_average_talents()
This commit is contained in:
parent
5373da9c30
commit
9d144835ed
10
src/team.c
10
src/team.c
|
@ -1030,13 +1030,15 @@ team_get_average_talents(const GArray *teams)
|
||||||
if(teams->len == 0)
|
if(teams->len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for(i=0;i<teams->len;i++)
|
for(i=0;i<teams->len;i++) {
|
||||||
for(j=0;j<g_array_index(teams, Team, i).players->len;j++)
|
const Team *team = &g_array_index(teams, Team, i);
|
||||||
|
for(j=0;j<team->players->len;j++)
|
||||||
{
|
{
|
||||||
sum += g_array_index(g_array_index(teams, Team, i).players,
|
const Player *player = &g_array_index(team->players, Player, j);
|
||||||
Player, j).talent;
|
sum += player->talent;
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sum / (gfloat)cnt;
|
return sum / (gfloat)cnt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue