mirror of https://github.com/tstellar/bygfoot.git
Refactor cup_reset()
This commit is contained in:
parent
f56e1b64be
commit
37b9d8bf46
16
src/cup.c
16
src/cup.c
|
@ -167,18 +167,18 @@ cup_reset(Cup *cup)
|
||||||
|
|
||||||
for(i=0;i<cup->rounds->len;i++)
|
for(i=0;i<cup->rounds->len;i++)
|
||||||
{
|
{
|
||||||
if(g_array_index(cup->rounds, CupRound, i).tables->len > 0)
|
CupRound *cup_round = &g_array_index(cup->rounds, CupRound, i);
|
||||||
|
if(cup_round->tables->len > 0)
|
||||||
{
|
{
|
||||||
free_tables(&g_array_index(cup->rounds, CupRound, i).tables);
|
free_tables(&cup_round->tables);
|
||||||
g_array_index(cup->rounds, CupRound, i).tables =
|
cup_round->tables = g_array_new(FALSE, FALSE, sizeof(Table));
|
||||||
g_array_new(FALSE, FALSE, sizeof(Table));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_array_index(cup->rounds, CupRound, i).teams->len > 0)
|
if(cup_round->teams->len> 0)
|
||||||
free_teams_array(&g_array_index(cup->rounds, CupRound, i).teams, TRUE);
|
free_teams_array(&cup_round->teams, TRUE);
|
||||||
|
|
||||||
g_ptr_array_free(g_array_index(cup->rounds, CupRound, i).team_ptrs, TRUE);
|
g_ptr_array_free(cup_round->team_ptrs, TRUE);
|
||||||
g_array_index(cup->rounds, CupRound, i).team_ptrs = g_ptr_array_new();
|
cup_round->team_ptrs = g_ptr_array_new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue