diff --git a/src/cup.c b/src/cup.c index 0a9488ff..d597820f 100644 --- a/src/cup.c +++ b/src/cup.c @@ -106,11 +106,17 @@ cup_reset(Cup *cup) for(i=0;irounds->len;i++) { - for(j=0;jrounds, CupRound, i).tables->len;j++) - free_table(&g_array_index(g_array_index(cup->rounds, CupRound, i).tables, Table, j)); - - g_array_free(g_array_index(cup->rounds, CupRound, i).tables, TRUE); - g_array_index(cup->rounds, CupRound, i).tables = g_array_new(FALSE, FALSE, sizeof(Table)); + if(g_array_index(cup->rounds, CupRound, i).tables->len > 0) + { + for(j=0;jrounds, CupRound, i).tables->len;j++) + free_table(&g_array_index(g_array_index(cup->rounds, CupRound, i).tables, Table, j)); + + g_array_free(g_array_index(cup->rounds, CupRound, i).tables, TRUE); + g_array_index(cup->rounds, CupRound, i).tables = g_array_new(FALSE, FALSE, sizeof(Table)); + } + + if(g_array_index(cup->rounds, CupRound, i).teams->len > 0) + free_teams_array(&g_array_index(cup->rounds, CupRound, i).teams, TRUE); } } diff --git a/src/game.c b/src/game.c index 8d0ab981..62f3a334 100644 --- a/src/game.c +++ b/src/game.c @@ -59,18 +59,6 @@ game_get_values(const Fixture *fix, gfloat team_values[][GAME_TEAM_VALUE_END], team_values[i][GAME_TEAM_VALUE_DEFEND] *= (1 - style_factor); team_values[i][GAME_TEAM_VALUE_ATTACK] *= (1 + style_factor); - - /*d*/ -/* if(fixture_user_team_involved(fix) != -1) */ -/* { */ -/* printf("week %d %d\n", week, week_round); */ -/* printf("%s attack %.1f midf %.1f defend %.1f style %d struct %d\n", */ -/* tm[i]->name->str, */ -/* team_values[i][GAME_TEAM_VALUE_ATTACK], */ -/* team_values[i][GAME_TEAM_VALUE_MIDFIELD], */ -/* team_values[i][GAME_TEAM_VALUE_DEFEND], */ -/* tm[i]->style, tm[i]->structure); */ -/* } */ } } diff --git a/src/league.c b/src/league.c index e5f59976..eee33acd 100644 --- a/src/league.c +++ b/src/league.c @@ -426,6 +426,10 @@ league_season_start(League *league) if(team_is_user(&g_array_index(league->teams, Team, i)) == -1) team_update_cpu_structure(&g_array_index(league->teams, Team, i)); + + g_array_index(league->teams, Team, i).stadium.average_attendance = + g_array_index(league->teams, Team, i).stadium.games = + g_array_index(league->teams, Team, i).stadium.possible_attendance = 0; } }