Player12
An open source football management simulator
Loading...
Searching...
No Matches
calendar.h File Reference
#include <cstdint>
#include <map>
#include <vector>
#include "gamedate.h"
#include "match.h"

Go to the source code of this file.

Classes

struct  SeasonCalendar::InternationalWindow
 Days in which clubs release players to their national teams. More...
 
class  Calendar
 Manages the match calendar for a season. More...
 

Namespaces

namespace  SeasonCalendar
 Season date rules shared by the calendar and the competitions.
 

Functions

int SeasonCalendar::restDays (MatchType earlier, MatchType later)
 
uint8_t SeasonCalendar::dayOfWeek (const GameDateValue &date)
 Weekday of a date, 0 = Monday ... 6 = Sunday.
 
GameDateValue SeasonCalendar::addDays (const GameDateValue &date, int days)
 Adds (or subtracts) days in O(1).
 
uint16_t SeasonCalendar::seasonStartYear (const GameDateValue &date)
 Calendar year in which the season containing date started.
 
GameDateValue SeasonCalendar::leagueStart (uint16_t season_year)
 First league Saturday (first Saturday on or after 15 August).
 
GameDateValue SeasonCalendar::leagueEnd (uint16_t season_year)
 Last regular league Saturday (on or before 24 May).
 
std::vector< InternationalWindow > SeasonCalendar::internationalWindows (uint16_t season_year)
 Windows of the season starting in season_year, by date.
 
bool SeasonCalendar::isInternationalBreak (const GameDateValue &date)
 
bool SeasonCalendar::isWinterBreak (const GameDateValue &date)
 
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.
 
bool SeasonCalendar::isContinentalWeek (const GameDateValue &date)
 True from Tuesday to Thursday of a continental club week.
 
bool SeasonCalendar::isBlackout (const GameDateValue &date)
 No competitive fixtures may be scheduled on this date.
 
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).
 
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.
 
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.
 
GameDateValue SeasonCalendar::nextFreeMidweek (const GameDateValue &date)
 First Wednesday after date that is not in a break.
 

Variables

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