Player12
An open source football management simulator
Loading...
Searching...
No Matches
SeasonCalendar Namespace Reference

Season date rules shared by the calendar and the competitions. More...

Classes

struct  InternationalWindow
 Days in which clubs release players to their national teams. More...
 

Functions

int restDays (MatchType earlier, MatchType later)
 
uint8_t dayOfWeek (const GameDateValue &date)
 Weekday of a date, 0 = Monday ... 6 = Sunday.
 
GameDateValue addDays (const GameDateValue &date, int days)
 Adds (or subtracts) days in O(1).
 
uint16_t seasonStartYear (const GameDateValue &date)
 Calendar year in which the season containing date started.
 
GameDateValue leagueStart (uint16_t season_year)
 First league Saturday (first Saturday on or after 15 August).
 
GameDateValue leagueEnd (uint16_t season_year)
 Last regular league Saturday (on or before 24 May).
 
std::vector< InternationalWindow > internationalWindows (uint16_t season_year)
 Windows of the season starting in season_year, by date.
 
bool isInternationalBreak (const GameDateValue &date)
 
bool isWinterBreak (const GameDateValue &date)
 
std::vector< GameDateValue > continentalWeeks (uint16_t season_year)
 Tuesday of every continental club week (see CONTINENTAL_WEEKS). Continental matches are played Tuesday to Thursday; domestic midweek rounds and cup ties avoid these weeks.
 
bool isContinentalWeek (const GameDateValue &date)
 True from Tuesday to Thursday of a continental club week.
 
bool isBlackout (const GameDateValue &date)
 No competitive fixtures may be scheduled on this date.
 
std::vector< GameDateValue > leagueRoundDates (uint16_t season_year, size_t rounds, uint8_t variant=0)
 Anchor date of each league round: a Saturday for weekend rounds (matches spread from Friday to Monday) or a Wednesday for midweek rounds (Tuesday and Wednesday).
 
std::vector< GameDateValue > cupRoundDates (uint16_t season_year, size_t rounds)
 Date of each cup round; the last one (the final) is a Saturday.
 
std::vector< GameDateValue > friendlyDates (const GameDateValue &from, size_t count)
 Saturdays of the pre-season friendly weeks after from and before the league; each week's friendlies are spread from Tuesday to Sunday.
 
GameDateValue nextFreeMidweek (const GameDateValue &date)
 First Wednesday after date that is not in a break.
 

Variables

constexpr uint8_t MONDAY = 0
 
constexpr uint8_t TUESDAY = 1
 
constexpr uint8_t WEDNESDAY = 2
 
constexpr uint8_t THURSDAY = 3
 
constexpr uint8_t FRIDAY = 4
 
constexpr uint8_t SATURDAY = 5
 
constexpr uint8_t SUNDAY = 6
 
constexpr int MIN_REST_DAYS = 2
 
constexpr int MIN_REST_BEFORE_TIE = 3
 
constexpr uint8_t SEASON_START_MONTH = 7
 
constexpr size_t MAX_CUP_ROUNDS = 8
 
constexpr size_t PRESEASON_FRIENDLIES = 4
 
constexpr size_t CONTINENTAL_WEEKS = 16
 

Detailed Description

Season date rules shared by the calendar and the competitions.

A season runs from July (friendlies) to May. Each league round is spread over a long weekend (Friday to Monday) or, for the few midweek rounds, over Tuesday and Wednesday, following the league's own day pattern (round_days in leagues.json). Cups are played on Wednesdays with the final on the Saturday after the last league weekend. Continental club competitions use their own Tuesday-Thursday weeks. There is a winter break and the international windows (September/October, November, March and June) during which no competitive club matches are played.

Function Documentation

◆ addDays()

GameDateValue SeasonCalendar::addDays ( const GameDateValue &  date,
int  days 
)

Adds (or subtracts) days in O(1).

◆ continentalWeeks()

std::vector< GameDateValue > SeasonCalendar::continentalWeeks ( uint16_t  season_year)

Tuesday of every continental club week (see CONTINENTAL_WEEKS). Continental matches are played Tuesday to Thursday; domestic midweek rounds and cup ties avoid these weeks.

◆ cupRoundDates()

std::vector< GameDateValue > SeasonCalendar::cupRoundDates ( uint16_t  season_year,
size_t  rounds 
)

Date of each cup round; the last one (the final) is a Saturday.

◆ dayOfWeek()

uint8_t SeasonCalendar::dayOfWeek ( const GameDateValue &  date)

Weekday of a date, 0 = Monday ... 6 = Sunday.

◆ friendlyDates()

std::vector< GameDateValue > SeasonCalendar::friendlyDates ( const GameDateValue &  from,
size_t  count 
)

Saturdays of the pre-season friendly weeks after from and before the league; each week's friendlies are spread from Tuesday to Sunday.

◆ internationalWindows()

std::vector< SeasonCalendar::InternationalWindow > SeasonCalendar::internationalWindows ( uint16_t  season_year)

Windows of the season starting in season_year, by date.

◆ isBlackout()

bool SeasonCalendar::isBlackout ( const GameDateValue &  date)

No competitive fixtures may be scheduled on this date.

◆ isContinentalWeek()

bool SeasonCalendar::isContinentalWeek ( const GameDateValue &  date)

True from Tuesday to Thursday of a continental club week.

◆ isInternationalBreak()

bool SeasonCalendar::isInternationalBreak ( const GameDateValue &  date)

◆ isWinterBreak()

bool SeasonCalendar::isWinterBreak ( const GameDateValue &  date)

◆ leagueEnd()

GameDateValue SeasonCalendar::leagueEnd ( uint16_t  season_year)

Last regular league Saturday (on or before 24 May).

◆ leagueRoundDates()

std::vector< GameDateValue > SeasonCalendar::leagueRoundDates ( uint16_t  season_year,
size_t  rounds,
uint8_t  variant = 0 
)

Anchor date of each league round: a Saturday for weekend rounds (matches spread from Friday to Monday) or a Wednesday for midweek rounds (Tuesday and Wednesday).

Parameters
variant0 for top divisions; lower divisions (1) play the midweek rounds they need in other weeks (or on up to two weekends after the top flight has finished), so the midweek days of the two tiers do not pile up.

◆ leagueStart()

GameDateValue SeasonCalendar::leagueStart ( uint16_t  season_year)

First league Saturday (first Saturday on or after 15 August).

◆ nextFreeMidweek()

GameDateValue SeasonCalendar::nextFreeMidweek ( const GameDateValue &  date)

First Wednesday after date that is not in a break.

◆ restDays()

int SeasonCalendar::restDays ( MatchType  earlier,
MatchType  later 
)

Days a club needs between an earlier and a later competitive match: MIN_REST_BEFORE_TIE from a league match to a cup or continental tie, MIN_REST_DAYS otherwise.

◆ seasonStartYear()

uint16_t SeasonCalendar::seasonStartYear ( const GameDateValue &  date)

Calendar year in which the season containing date started.

Variable Documentation

◆ CONTINENTAL_WEEKS

constexpr size_t SeasonCalendar::CONTINENTAL_WEEKS = 16
constexpr

Continental club weeks per season: eight league-phase matchdays and two legs each of the play-off, round of 16, quarter- and semi-finals.

◆ FRIDAY

constexpr uint8_t SeasonCalendar::FRIDAY = 4
constexpr

◆ MAX_CUP_ROUNDS

constexpr size_t SeasonCalendar::MAX_CUP_ROUNDS = 8
constexpr

◆ MIN_REST_BEFORE_TIE

constexpr int SeasonCalendar::MIN_REST_BEFORE_TIE = 3
constexpr

Fewest days between a league match and a midweek cup or continental tie that follows it (two free days in between).

◆ MIN_REST_DAYS

constexpr int SeasonCalendar::MIN_REST_DAYS = 2
constexpr

Fewest days between two competitive matches of a club (48 hours).

◆ MONDAY

constexpr uint8_t SeasonCalendar::MONDAY = 0
constexpr

◆ PRESEASON_FRIENDLIES

constexpr size_t SeasonCalendar::PRESEASON_FRIENDLIES = 4
constexpr

◆ SATURDAY

constexpr uint8_t SeasonCalendar::SATURDAY = 5
constexpr

◆ SEASON_START_MONTH

constexpr uint8_t SeasonCalendar::SEASON_START_MONTH = 7
constexpr

◆ SUNDAY

constexpr uint8_t SeasonCalendar::SUNDAY = 6
constexpr

◆ THURSDAY

constexpr uint8_t SeasonCalendar::THURSDAY = 3
constexpr

◆ TUESDAY

constexpr uint8_t SeasonCalendar::TUESDAY = 1
constexpr

◆ WEDNESDAY

constexpr uint8_t SeasonCalendar::WEDNESDAY = 2
constexpr