diff --git a/src/team.c b/src/team.c index 7eff61df..468e4735 100644 --- a/src/team.c +++ b/src/team.c @@ -280,6 +280,9 @@ team_get_fixture(const Team *tm, gboolean last_fixture) if(!query_league_active(&lig(i))) continue; + if (!query_team_id_is_in_teams_array(tm, lig(i).teams)) + continue; + for(j=0;jlen;j++) { const Fixture *current_fixture = &g_array_index(lig(i).fixtures, Fixture, j); if(current_fixture->attendance == -1 && @@ -1180,6 +1183,22 @@ query_team_is_in_teams_array(const Team *tm, const GPtrArray *teams) return FALSE; } +/** Same as query_team_is_in_teams_array, but it looks up based on the + * team id and not the pointer. This is useful, because you can look + * for a team in a GArray without having to transform it into a GPtrArray. + */ +gboolean +query_team_id_is_in_teams_array(const Team *tm, const GArray *teams) +{ + gint i; + for (i = 0; i< teams->len; i++) { + const Team *t = &g_array_index(teams, Team, i); + if (t->id == tm->id) + return TRUE; + } + return FALSE; +} + /** Check whether we find a definition file for the given team. */ gchar* diff --git a/src/team.h b/src/team.h index cf601671..daf9b184 100644 --- a/src/team.h +++ b/src/team.h @@ -145,6 +145,9 @@ team_write_own_results(const Team *tm, gchar *buf, gboolean sort, gboolean cup_m gboolean query_team_is_in_teams_array(const Team *tm, const GPtrArray *teams); +gboolean +query_team_id_is_in_teams_array(const Team *tm, const GArray *teams); + gchar* team_has_def_file(const Team *tm);