2004-12-30 17:48:19 +01:00
|
|
|
#ifndef LEAGUE_H
|
|
|
|
#define LEAGUE_H
|
2004-12-23 13:58:39 +01:00
|
|
|
|
|
|
|
#include "bygfoot.h"
|
2005-06-05 12:39:29 +02:00
|
|
|
#include "cup.h"
|
2004-12-30 17:48:19 +01:00
|
|
|
#include "league_struct.h"
|
2005-03-19 21:04:08 +01:00
|
|
|
#include "fixture_struct.h"
|
2004-12-23 13:58:39 +01:00
|
|
|
|
2005-05-08 19:56:26 +02:00
|
|
|
#define league_cup_get_teams(clid) (clid < ID_CUP_START) ? ((gpointer)(league_from_clid(clid)->teams)) : ((gpointer)(cup_from_clid(clid)->teams))
|
2005-04-16 09:46:04 +02:00
|
|
|
#define league_cup_get_fixtures(clid) (clid < ID_CUP_START) ? (league_from_clid(clid)->fixtures) : (cup_from_clid(clid)->fixtures)
|
2005-04-07 23:10:31 +02:00
|
|
|
#define league_cup_get_name_string(clid) (clid < ID_CUP_START) ? league_from_clid(clid)->name->str : cup_from_clid(clid)->name->str
|
2005-04-16 09:46:04 +02:00
|
|
|
#define league_cup_get_yellow_red(clid) (clid < ID_CUP_START) ? (league_from_clid(clid)->yellow_red) : (cup_from_clid(clid)->yellow_red)
|
2005-03-27 19:59:57 +02:00
|
|
|
|
2005-05-28 12:41:53 +02:00
|
|
|
#define query_league_has_prom_games(league) (strlen(league->prom_rel.prom_games_dest_sid->str) > 0)
|
2005-04-14 21:07:25 +02:00
|
|
|
|
2005-08-15 15:18:28 +02:00
|
|
|
/** A struct needed when managing promotions
|
|
|
|
and relegations. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Team tm; /**< The team we move. */
|
|
|
|
GArray *dest_idcs; /**< Array of possible destination indices. */
|
|
|
|
gint prom_rel_type; /**< Promotion or relegation */
|
|
|
|
gboolean dest_assigned; /**< Whether a destination league for the team
|
|
|
|
is already assigned. */
|
|
|
|
} TeamMove;
|
|
|
|
|
|
|
|
|
2004-12-23 13:58:39 +01:00
|
|
|
League
|
2005-04-14 21:07:25 +02:00
|
|
|
league_new(gboolean new_id);
|
2004-12-23 13:58:39 +01:00
|
|
|
|
|
|
|
PromRelElement
|
|
|
|
prom_rel_element_new(void);
|
|
|
|
|
2005-01-09 21:21:22 +01:00
|
|
|
gint
|
|
|
|
league_cup_get_index_from_clid(gint clid);
|
|
|
|
|
2005-03-03 13:46:48 +01:00
|
|
|
League*
|
|
|
|
league_from_clid(gint clid);
|
|
|
|
|
2005-03-14 18:47:27 +01:00
|
|
|
gint
|
|
|
|
league_cup_get_next_clid(gint clid);
|
|
|
|
|
|
|
|
gint
|
|
|
|
league_cup_get_previous_clid(gint clid);
|
|
|
|
|
|
|
|
Fixture*
|
|
|
|
league_cup_get_next_fixture(gint clid, gint week_number, gint week_round_number);
|
|
|
|
|
|
|
|
Fixture*
|
|
|
|
league_cup_get_previous_fixture(gint clid, gint week_number, gint week_round_number);
|
|
|
|
|
2005-03-16 21:48:25 +01:00
|
|
|
gint
|
|
|
|
league_cup_average_capacity(gint clid);
|
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
void
|
|
|
|
league_get_team_movements(League *league, GArray *team_movements);
|
|
|
|
|
|
|
|
gint
|
|
|
|
league_index_from_sid(const gchar *sid);
|
|
|
|
|
|
|
|
void
|
|
|
|
league_remove_team_with_id(League *league, gint id);
|
|
|
|
|
|
|
|
void
|
|
|
|
league_season_start(League *league);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
query_league_rank_in_prom_games(const League *league, gint rank);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
query_league_prom_games_begin(const League *league);
|
|
|
|
|
2005-04-24 16:19:57 +02:00
|
|
|
gboolean
|
|
|
|
query_league_matches_in_week(const League *league, gint week_number);
|
|
|
|
|
2005-06-25 16:09:37 +02:00
|
|
|
void
|
|
|
|
league_get_team_movements_prom_rel(const League *league, GArray *team_movements);
|
|
|
|
|
|
|
|
void
|
|
|
|
league_get_team_movements_prom_games(const League *league, GArray *team_movements,
|
|
|
|
const GPtrArray *prom_games_teams, gboolean up);
|
|
|
|
|
2005-08-14 21:03:11 +02:00
|
|
|
void
|
|
|
|
league_team_movements_destinations(GArray *team_movements, const gint *league_size);
|
|
|
|
|
|
|
|
void
|
|
|
|
league_team_movements_prune(GArray *team_movements, const gint *league_size,
|
|
|
|
gint *league_cur_size);
|
|
|
|
|
|
|
|
void
|
|
|
|
league_team_movements_assign_dest(GArray *team_movements, gint idx,
|
|
|
|
const gint *league_size, gint *league_cur_size);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
query_league_team_movements_unassigned_single(const GArray *team_movements);
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
query_league_team_movements_unassigned(const GArray *team_movements);
|
|
|
|
|
|
|
|
void
|
|
|
|
league_team_movements_print(const GArray *team_movements,
|
|
|
|
const gint *league_size, const gint *league_cur_size);
|
|
|
|
|
|
|
|
gint
|
|
|
|
league_team_movements_compare_dest_idcs(gconstpointer a, gconstpointer b,
|
|
|
|
gpointer data);
|
|
|
|
|
2005-09-28 12:21:43 +02:00
|
|
|
gboolean
|
|
|
|
query_leagues_active_in_country(void);
|
|
|
|
|
2004-12-23 13:58:39 +01:00
|
|
|
#endif
|