Refactor team_get_average_talents()

This commit is contained in:
Tom Stellard 2021-03-16 20:51:54 -07:00 committed by Tom Stellard
parent 5373da9c30
commit 9d144835ed
1 changed files with 6 additions and 4 deletions

View File

@ -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;
} }