|
Player12
An open source football management simulator
|
Manages the match calendar for a season. More...
#include <calendar.h>
Public Member Functions | |
| Calendar ()=default | |
| Default constructor. | |
| void | generate (const class GameData &gamedata, const GameDateValue &startDate) |
| Generates the full calendar of the season starting on a date. | |
| void | addMatch (const Match &match) |
| Adds a single match to the calendar. | |
| const std::map< GameDateValue, std::vector< Match > > & | getFullCalendar () const |
| Gets the full calendar schedule. | |
| const std::vector< Match > & | getMatchesForDate (const GameDateValue &date) const |
| Gets the matches scheduled for a specific date. | |
| std::vector< Match > & | getMatchesForDateMutable (const GameDateValue &date) |
| const Match * | findMatch (const GameDateValue &date, TeamID home_id, TeamID away_id) const |
| Finds a fixture by its natural key (date, home, away). | |
| Match * | findMatch (const GameDateValue &date, TeamID home_id, TeamID away_id) |
| std::vector< Match > | getTeamFixtures (TeamID team_id) const |
| All fixtures of a team in date order. | |
| size_t | protectRest (const GameDateValue &after) |
| Keeps clubs rested around cup and continental ties. | |
| void | markRestChecked () |
| Treats the current fixtures as already checked by protectRest() (fixtures loaded from a save keep their dates). | |
Private Member Functions | |
| void | generateSeasonFixtures (const class GameData &gamedata, uint16_t season_year) |
| void | generateFriendlies (const class GameData &gamedata, const GameDateValue &startDate, size_t numFriendlies) |
Private Attributes | |
| std::map< GameDateValue, std::vector< Match > > | schedule |
| bool | rest_check_pending = false |
Manages the match calendar for a season.
This class is responsible for generating and storing the match schedule, including season fixtures, cup ties and friendlies.
|
default |
Default constructor.
| void Calendar::addMatch | ( | const Match & | match | ) |
Adds a single match to the calendar.
| match | The match to add. |
| Match * Calendar::findMatch | ( | const GameDateValue & | date, |
| TeamID | home_id, | ||
| TeamID | away_id | ||
| ) |
| const Match * Calendar::findMatch | ( | const GameDateValue & | date, |
| TeamID | home_id, | ||
| TeamID | away_id | ||
| ) | const |
Finds a fixture by its natural key (date, home, away).
| void Calendar::generate | ( | const class GameData & | gamedata, |
| const GameDateValue & | startDate | ||
| ) |
Generates the full calendar of the season starting on a date.
| startDate | First day of the season (early July). |
|
private |
|
private |
| const std::map< GameDateValue, std::vector< Match > > & Calendar::getFullCalendar | ( | ) | const |
Gets the full calendar schedule.
| const std::vector< Match > & Calendar::getMatchesForDate | ( | const GameDateValue & | date | ) | const |
Gets the matches scheduled for a specific date.
| date | The date to query. |
| std::vector< Match > & Calendar::getMatchesForDateMutable | ( | const GameDateValue & | date | ) |
All fixtures of a team in date order.
|
inline |
Treats the current fixtures as already checked by protectRest() (fixtures loaded from a save keep their dates).
| size_t Calendar::protectRest | ( | const GameDateValue & | after | ) |
Keeps clubs rested around cup and continental ties.
When cup or continental fixtures were added since the last call, every unplayed league fixture after after that leaves a club less than MIN_REST_BEFORE_TIE days before such a tie (or less than MIN_REST_DAYS from any other competitive match) moves to the nearest day of its round (Friday-Monday, or Tuesday-Thursday for midweek rounds) that suits both clubs. Deterministic; a no-op when nothing was added.
|
private |
|
private |