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

Training ground, medical centre and stadium projects. More...

#include <facility_projects.h>

Public Member Functions

ProjectQuote quote (const GameData &gamedata, TeamID team_id, FacilityProjectType type, std::uint32_t seats=0) const
 
ProjectVerdict request (GameData &gamedata, const BoardState &board, TeamID team_id, FacilityProjectType type, std::uint32_t seats, const GameDateValue &today)
 
void onDay (GameData &gamedata, const GameDateValue &date, TeamID managed_team_id, Inbox &inbox)
 
std::uint8_t medicalLevel (TeamID team_id) const
 
float layoffMultiplier (TeamID team_id) const
 
std::vector< FacilityProject > projectsFor (TeamID team_id) const
 
std::optional< GameDateValue > cooldownUntil (TeamID team_id, FacilityProjectType type, const GameDateValue &today) 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

void complete (GameData &gamedata, FacilityProject &project, const GameDateValue &date, TeamID managed_team_id, Inbox &inbox)
 

Private Attributes

std::vector< FacilityProject > projects
 
std::unordered_map< TeamID, std::uint8_t > medical
 
std::map< std::pair< TeamID, std::uint8_t >, GameDateValue > cooldowns
 
std::uint32_t next_id = 1
 

Detailed Description

Training ground, medical centre and stadium projects.

The board approves a request from its confidence and the club's cash (BoardModel::reviewProject). A quarter of the cost is paid on approval and the rest in monthly instalments; a completed training ground raises the training facilities (training quality), a medical centre shortens injury layoffs and a stadium expansion adds seats (attendance and gate receipts once demand exceeds the old capacity). During a stadium expansion part of the ground is closed. Refused requests of a type wait BoardModel::PROJECT_COOLDOWN_DAYS.

Member Function Documentation

◆ clear()

void FacilityProjects::clear ( )

◆ complete()

void FacilityProjects::complete ( GameData &  gamedata,
FacilityProject &  project,
const GameDateValue &  date,
TeamID  managed_team_id,
Inbox &  inbox 
)
private

◆ cooldownUntil()

std::optional< GameDateValue > FacilityProjects::cooldownUntil ( TeamID  team_id,
FacilityProjectType  type,
const GameDateValue &  today 
) const

Day a refused type may be requested again (nullopt when free).

◆ layoffMultiplier()

float FacilityProjects::layoffMultiplier ( TeamID  team_id) const

Injury layoff multiplier of a club's medical centre.

◆ load()

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

◆ medicalLevel()

std::uint8_t FacilityProjects::medicalLevel ( TeamID  team_id) const

Medical centre level of a club (1-100, 50 = standard).

◆ onDay()

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

Instalments on the 1st, completion (with news for the managed club).

◆ projectsFor()

std::vector< FacilityProject > FacilityProjects::projectsFor ( TeamID  team_id) const

Projects of a club, running first, then completed (newest first).

◆ quote()

ProjectQuote FacilityProjects::quote ( const GameData &  gamedata,
TeamID  team_id,
FacilityProjectType  type,
std::uint32_t  seats = 0 
) const

Quote for a club today (seats only matter for stadiums).

◆ request()

ProjectVerdict FacilityProjects::request ( GameData &  gamedata,
const BoardState &  board,
TeamID  team_id,
FacilityProjectType  type,
std::uint32_t  seats,
const GameDateValue &  today 
)

Asks the board; on approval the project starts today and the deposit is booked to the ledger. A refusal starts the cooldown (except for AlreadyRunning / TooManyProjects / Cooldown).

◆ save()

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

Member Data Documentation

◆ cooldowns

std::map<std::pair<TeamID, std::uint8_t>, GameDateValue> FacilityProjects::cooldowns
private

◆ medical

std::unordered_map<TeamID, std::uint8_t> FacilityProjects::medical
private

◆ next_id

std::uint32_t FacilityProjects::next_id = 1
private

◆ projects

std::vector<FacilityProject> FacilityProjects::projects
private

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