2005-10-20 17:45:00 +02:00
|
|
|
/*
|
2005-11-26 17:52:51 +01:00
|
|
|
league_struct.h
|
|
|
|
|
2005-10-20 17:45:00 +02:00
|
|
|
Bygfoot Football Manager -- a small and simple GTK2-based
|
|
|
|
football management game.
|
|
|
|
|
|
|
|
http://bygfoot.sourceforge.net
|
|
|
|
|
|
|
|
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2004-12-30 17:48:19 +01:00
|
|
|
#ifndef LEAGUE_STRUCT_H
|
|
|
|
#define LEAGUE_STRUCT_H
|
|
|
|
|
2005-01-09 21:21:22 +01:00
|
|
|
#include "bygfoot.h"
|
2005-04-29 21:48:02 +02:00
|
|
|
#include "stat_struct.h"
|
|
|
|
#include "table_struct.h"
|
2005-03-15 16:10:57 +01:00
|
|
|
|
|
|
|
enum PromRelType
|
|
|
|
{
|
|
|
|
PROM_REL_PROMOTION = 0,
|
|
|
|
PROM_REL_RELEGATION,
|
|
|
|
PROM_REL_NONE
|
|
|
|
};
|
2004-12-30 17:48:19 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
An element representing a promotion or relegation rule.
|
|
|
|
This means, a PromRelElement specifies a range of teams
|
|
|
|
that get promoted or relegated to a given league.
|
|
|
|
@see PromRel
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint ranks[2]; /**< The range of teams; default 0 and 0 */
|
2008-11-23 12:48:36 +01:00
|
|
|
gint from_table; /**< From which table to pick the teams in case there are several. Default: 0. */
|
2005-10-09 11:35:44 +02:00
|
|
|
gchar *dest_sid; /**< The id of the destination league. Default "" */
|
2005-03-15 16:10:57 +01:00
|
|
|
gint type; /**< Type. Promotion or relegation or none. */
|
2020-09-20 06:08:56 +02:00
|
|
|
/** The maximum number of teams to promote/relegate. This can be different the
|
|
|
|
* size of the range of teams, since some leagues have teams
|
|
|
|
* (e.g. reserve teams) that may be inelligible for promotion. For example,
|
|
|
|
* a league could promote the top 2 elegible teams from positions 1-3.
|
|
|
|
* In that case ranks[0] = 1, ranks[1] = 3 and num_teams = 2.
|
|
|
|
*/
|
|
|
|
gint num_teams;
|
2004-12-30 17:48:19 +01:00
|
|
|
} PromRelElement;
|
|
|
|
|
2008-12-23 11:33:55 +01:00
|
|
|
/**
|
2009-01-03 12:24:00 +01:00
|
|
|
An struct representing promotion/relegation games.
|
2008-12-23 11:33:55 +01:00
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2020-10-09 00:17:45 +02:00
|
|
|
gint ranks[2]; /**< The range of teams; default 0 and 0. This is only valid
|
|
|
|
loser_sid == NULL. */
|
2008-12-23 11:33:55 +01:00
|
|
|
/** The id of the league the promotion games winner gets promoted to. Default "" */
|
|
|
|
gchar *dest_sid;
|
|
|
|
/** The id of the league the promotion games losers get moved to. Default "" */
|
|
|
|
gchar *loser_sid;
|
|
|
|
/** Number of teams that advance from the promotion games. Default: 1. */
|
|
|
|
gint number_of_advance;
|
|
|
|
/** The cup determining how the promotion games are handled. */
|
|
|
|
gchar *cup_sid;
|
|
|
|
|
|
|
|
} PromGames;
|
|
|
|
|
2004-12-30 17:48:19 +01:00
|
|
|
/**
|
|
|
|
This structure specifies how promotion and relegation is handled in a league.
|
|
|
|
It contains promotion and relegation rules in an array and possibly also
|
|
|
|
a rule about promotion games to be played.
|
|
|
|
@see PromRelElement
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** Array with promotion/relegation rules.
|
|
|
|
@see PromRelElement
|
|
|
|
*/
|
|
|
|
GArray *elements;
|
2005-03-15 16:10:57 +01:00
|
|
|
|
2008-12-23 11:33:55 +01:00
|
|
|
/** Array with promotion/relegation games.
|
|
|
|
@see PromGames
|
|
|
|
*/
|
|
|
|
GArray *prom_games;
|
|
|
|
|
2004-12-30 17:48:19 +01:00
|
|
|
} PromRel;
|
|
|
|
|
2008-11-20 21:20:18 +01:00
|
|
|
/**
|
|
|
|
A structure describing a different league joined to the current one
|
|
|
|
in the sense that there are matches played between teams from both leagues
|
|
|
|
like in the US conference system.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** Sid of the joined league. */
|
|
|
|
gchar *sid;
|
|
|
|
/** How many round robins to schedule. */
|
|
|
|
gint rr;
|
|
|
|
} JoinedLeague;
|
|
|
|
|
2008-11-22 17:51:31 +01:00
|
|
|
/**
|
|
|
|
A structure containing a week when a new table
|
|
|
|
gets created with nullified values for the league;
|
|
|
|
older tables get stored.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gint add_week;
|
|
|
|
gchar *name;
|
|
|
|
} NewTable;
|
|
|
|
|
2008-12-26 16:59:46 +01:00
|
|
|
/**
|
|
|
|
A structure describing a custom break in the fixtures
|
|
|
|
schedule occuring at a particular week.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** In which week the break occurs. */
|
|
|
|
gint week_number;
|
|
|
|
/** Length of break in weeks. */
|
|
|
|
gint length;
|
|
|
|
} WeekBreak;
|
|
|
|
|
2004-12-30 17:48:19 +01:00
|
|
|
/**
|
|
|
|
Representation of a league.
|
|
|
|
@see PromRel
|
|
|
|
@see Table
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/** Default value "" */
|
2005-10-09 11:35:44 +02:00
|
|
|
gchar *name, *short_name, *sid, *symbol;
|
2005-06-01 20:19:02 +02:00
|
|
|
/** The sid of the player names file the
|
|
|
|
teams in the league take their names from.
|
|
|
|
Default: 'general', meaning the 'player_names_general.xml' file. */
|
2005-10-09 11:35:44 +02:00
|
|
|
gchar *names_file;
|
2004-12-30 17:48:19 +01:00
|
|
|
/** @see PromRel */
|
|
|
|
PromRel prom_rel;
|
|
|
|
/** Numerical id, as opposed to the string id 'sid'. */
|
|
|
|
gint id;
|
2005-05-24 20:31:07 +02:00
|
|
|
/** Layer of the league; this specifies which leagues are
|
|
|
|
parallel. */
|
|
|
|
gint layer;
|
2004-12-30 17:48:19 +01:00
|
|
|
/** The first week games are played. Default 1. */
|
|
|
|
gint first_week;
|
|
|
|
/** Weeks between two matchdays. Default 1. */
|
|
|
|
gint week_gap;
|
2007-02-17 13:06:30 +01:00
|
|
|
/** Here we store intervals of fixtures during which
|
|
|
|
there should be two matches in a week instead of one. */
|
|
|
|
GArray *two_match_weeks[2];
|
2005-05-06 18:35:19 +02:00
|
|
|
/** How many round robins are played. Important for
|
2008-11-20 21:20:18 +01:00
|
|
|
small leagues with 10 teams or so. Default: 2. */
|
2005-05-06 18:35:19 +02:00
|
|
|
gint round_robins;
|
2007-02-17 13:06:30 +01:00
|
|
|
/** Number of weeks between the parts of a round robin. */
|
2008-12-14 11:37:10 +01:00
|
|
|
GArray *rr_breaks;
|
2004-12-30 17:48:19 +01:00
|
|
|
/** Number of yellow cards until a player gets banned.
|
|
|
|
Default 1000 (which means 'off', basically). */
|
|
|
|
gint yellow_red;
|
2005-09-21 19:42:41 +02:00
|
|
|
/** Average talent for the first season. Default: -1. */
|
|
|
|
gfloat average_talent;
|
2021-03-18 20:04:52 +01:00
|
|
|
/** Array of pointers for teams in the league.
|
2004-12-30 17:48:19 +01:00
|
|
|
@see Team */
|
2021-03-18 20:04:52 +01:00
|
|
|
GPtrArray *teams;
|
2008-11-20 21:20:18 +01:00
|
|
|
/** List of leagues joined fixture-wise to this one.
|
|
|
|
@see JoinedLeague */
|
|
|
|
GArray *joined_leagues;
|
2008-11-21 18:00:47 +01:00
|
|
|
/** League tables. Usually only one, sometimes more than one is created.
|
2004-12-30 17:48:19 +01:00
|
|
|
@see Table */
|
2008-11-21 18:00:47 +01:00
|
|
|
GArray *tables;
|
2008-11-22 17:51:31 +01:00
|
|
|
/** Array holding NewTable elements specifying when to add
|
|
|
|
a new table to the tables array. */
|
|
|
|
GArray *new_tables;
|
2005-01-09 21:21:22 +01:00
|
|
|
/** The fixtures of a season for the league. */
|
|
|
|
GArray *fixtures;
|
2008-11-24 12:16:36 +01:00
|
|
|
/** A gchar pointer array of properties (like "inactive"). */
|
|
|
|
GPtrArray *properties;
|
2008-12-26 16:59:46 +01:00
|
|
|
/** Array of custom breaks in schedule. */
|
|
|
|
GArray *week_breaks;
|
2005-04-29 21:48:02 +02:00
|
|
|
/** The current league statistics. */
|
|
|
|
LeagueStat stats;
|
2009-01-08 23:20:26 +01:00
|
|
|
/** Pointer array with the sids of competitions that
|
|
|
|
the fixtures of which should be avoided when scheduling
|
|
|
|
the league fixtures. */
|
|
|
|
GPtrArray *skip_weeks_with;
|
2004-12-30 17:48:19 +01:00
|
|
|
} League;
|
|
|
|
|
|
|
|
#endif
|