|
Player12
An open source football management simulator
|
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 |
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.
| void FacilityProjects::clear | ( | ) |
|
private |
| 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).
| float FacilityProjects::layoffMultiplier | ( | TeamID | team_id | ) | const |
Injury layoff multiplier of a club's medical centre.
| void FacilityProjects::load | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) |
| std::uint8_t FacilityProjects::medicalLevel | ( | TeamID | team_id | ) | const |
Medical centre level of a club (1-100, 50 = standard).
| 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).
| std::vector< FacilityProject > FacilityProjects::projectsFor | ( | TeamID | team_id | ) | const |
Projects of a club, running first, then completed (newest first).
| 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).
| 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).
| void FacilityProjects::save | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) | const |
|
private |
|
private |
|
private |
|
private |