Player12
An open source football management simulator
Loading...
Searching...
No Matches
PreseasonPlanner Class Reference

Friendlies, tour and training camp of the managed club. More...

#include <preseason.h>

Public Member Functions

std::vector< FriendlySlot > friendlies (const Calendar &calendar, TeamID managed_team_id, const GameDateValue &today) const
 
std::vector< OpponentOption > opponents (const GameData &gamedata, const Calendar &calendar, TeamID managed_team_id, const GameDateValue &date, OpponentLevel level, bool abroad) const
 
bool setFriendly (Calendar &calendar, const GameData &gamedata, TeamID managed_team_id, const GameDateValue &date, TeamID opponent_id, bool home, bool tour, const GameDateValue &today)
 
std::vector< FriendlySuggestion > suggest (const GameData &gamedata, const Calendar &calendar, TeamID managed_team_id, const GameDateValue &today) const
 
TrainingCamp suggestCamp (const GameData &gamedata, const Calendar &calendar, TeamID managed_team_id, const GameDateValue &today) const
 
CampQuote campQuote (const GameData &gamedata, const Calendar &calendar, TeamID managed_team_id, TrainingCamp camp) const
 
bool bookCamp (GameData &gamedata, const Calendar &calendar, TeamID managed_team_id, TrainingCamp camp, const GameDateValue &today)
 
void onDay (GameData &gamedata, const GameDateValue &date, TeamID managed_team_id, Inbox &inbox)
 
void onMatchPlayed (GameData &gamedata, const MatchReport &report, TeamID managed_team_id)
 
void onSeasonStart (std::uint16_t season_year)
 
const PreseasonState & getState () const
 
void clear ()
 
void load (const std::shared_ptr< DatabaseConnection > &db_conn)
 
void save (const std::shared_ptr< DatabaseConnection > &db_conn) const
 

Private Member Functions

std::optional< GameDateValue > firstFriendly (const Calendar &calendar, TeamID managed_team_id) const
 

Private Attributes

PreseasonState state
 

Detailed Description

Friendlies, tour and training camp of the managed club.

Every club plays the generated pre-season friendlies, one a week (spread from Tuesday to Sunday). Choosing an opponent swaps fixtures within that week (the managed club's old opponent meets the new opponent's old one on the day the new opponent was to play), so nobody plays twice a week or loses a match. Away friendlies against clubs from another country can be booked as tour dates.

Member Function Documentation

◆ bookCamp()

bool PreseasonPlanner::bookCamp ( GameData &  gamedata,
const Calendar &  calendar,
TeamID  managed_team_id,
TrainingCamp  camp,
const GameDateValue &  today 
)

Books (or with None cancels, refunded) the camp before it starts; the cost is paid today.

◆ campQuote()

CampQuote PreseasonPlanner::campQuote ( const GameData &  gamedata,
const Calendar &  calendar,
TeamID  managed_team_id,
TrainingCamp  camp 
) const

◆ clear()

void PreseasonPlanner::clear ( )

◆ firstFriendly()

std::optional< GameDateValue > PreseasonPlanner::firstFriendly ( const Calendar &  calendar,
TeamID  managed_team_id 
) const
private

◆ friendlies()

std::vector< FriendlySlot > PreseasonPlanner::friendlies ( const Calendar &  calendar,
TeamID  managed_team_id,
const GameDateValue &  today 
) const

The managed club's friendlies before its first competitive match.

◆ getState()

const PreseasonState & PreseasonPlanner::getState ( ) const
inline

◆ load()

void PreseasonPlanner::load ( const std::shared_ptr< DatabaseConnection > &  db_conn)

◆ onDay()

void PreseasonPlanner::onDay ( GameData &  gamedata,
const GameDateValue &  date,
TeamID  managed_team_id,
Inbox &  inbox 
)

Applies the camp on its last day.

◆ onMatchPlayed()

void PreseasonPlanner::onMatchPlayed ( GameData &  gamedata,
const MatchReport &  report,
TeamID  managed_team_id 
)

Tour fees and the tour's reputation point.

◆ onSeasonStart()

void PreseasonPlanner::onSeasonStart ( std::uint16_t  season_year)

A new season: last season's choices are archived.

◆ opponents()

std::vector< OpponentOption > PreseasonPlanner::opponents ( const GameData &  gamedata,
const Calendar &  calendar,
TeamID  managed_team_id,
const GameDateValue &  date,
OpponentLevel  level,
bool  abroad 
) const

Clubs free to be swapped in on date (their only match that week is an unplayed friendly, or none), best fit first.

◆ save()

void PreseasonPlanner::save ( const std::shared_ptr< DatabaseConnection > &  db_conn) const

◆ setFriendly()

bool PreseasonPlanner::setFriendly ( Calendar &  calendar,
const GameData &  gamedata,
TeamID  managed_team_id,
const GameDateValue &  date,
TeamID  opponent_id,
bool  home,
bool  tour,
const GameDateValue &  today 
)

Sets the opponent and venue of the friendly on date; tour books it as a tour date (only away against a club from another country).

◆ suggest()

std::vector< FriendlySuggestion > PreseasonPlanner::suggest ( const GameData &  gamedata,
const Calendar &  calendar,
TeamID  managed_team_id,
const GameDateValue &  today 
) const

The assistant's plan: weaker and similar sides at home, a stronger one away (abroad for clubs with a following).

◆ suggestCamp()

TrainingCamp PreseasonPlanner::suggestCamp ( const GameData &  gamedata,
const Calendar &  calendar,
TeamID  managed_team_id,
const GameDateValue &  today 
) const

The camp the assistant recommends for this club's finances.

Member Data Documentation

◆ state

PreseasonState PreseasonPlanner::state
private

The documentation for this class was generated from the following files: