|
Player12
An open source football management simulator
|
The medical staff's day-to-day work for the managed club: rest and minute-limit instructions, the 28-day load log behind the load chart, aggravated injuries of players who play through pain and the staff's warnings in the inbox. More...
#include <medical_centre.h>
Classes | |
| struct | LoadLog |
Public Member Functions | |
| std::uint8_t | flags (PlayerID player_id) const |
| bool | hasFlag (PlayerID player_id, MedicalFlag flag) const |
| void | setFlag (PlayerID player_id, MedicalFlag flag, bool enabled) |
| bool | isRested (PlayerID player_id) const |
| bool | afterMatch (GameData &gamedata, const GameDateValue &date, PlayerID player_id, int minutes, bool engine_injured, TeamID managed_team_id, Inbox &inbox) const |
| void | onDayEnd (GameData &gamedata, const GameDateValue &date, TeamID managed_team_id, Inbox &inbox) |
| std::array< LoadChartDay, MedicalCentre::LOAD_CHART_DAYS > | loadChart (PlayerID player_id, std::int32_t today) const |
| void | load (const std::shared_ptr< DatabaseConnection > &db_conn) |
| void | save (const std::shared_ptr< DatabaseConnection > &db_conn) const |
Private Member Functions | |
| void | record (PlayerID player_id, std::int32_t day, float load, float ratio) |
Private Attributes | |
| std::unordered_map< PlayerID, std::uint8_t > | player_flags |
| std::unordered_map< PlayerID, std::int32_t > | warned |
| std::unordered_map< PlayerID, LoadLog > | logs |
The medical staff's day-to-day work for the managed club: rest and minute-limit instructions, the 28-day load log behind the load chart, aggravated injuries of players who play through pain and the staff's warnings in the inbox.
Persisted in MedicalFlags and MedicalLoad (assets/db/schema.sql) inside the game's save transaction.
| bool MedicalDesk::afterMatch | ( | GameData & | gamedata, |
| const GameDateValue & | date, | ||
| PlayerID | player_id, | ||
| int | minutes, | ||
| bool | engine_injured, | ||
| TeamID | managed_team_id, | ||
| Inbox & | inbox | ||
| ) | const |
A player's match was applied (WorldSimulation::applyMatchConsequences returned true). If he played carrying an injury he may aggravate it: the chance is InjuryModel::aggravationChance() for his minutes, and certain when the match engine injured him again. The layoff is drawn by InjuryModel::aggravate() and shortened by the club's medical staff.
| std::uint8_t MedicalDesk::flags | ( | PlayerID | player_id | ) | const |
Flags of player_id (MEDICAL_FLAG_NONE when he has none).
|
inline |
|
inline |
Players the staff wants rested (not picked by the assistant).
| void MedicalDesk::load | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) |
| std::array< LoadChartDay, MedicalCentre::LOAD_CHART_DAYS > MedicalDesk::loadChart | ( | PlayerID | player_id, |
| std::int32_t | today | ||
| ) | const |
The last LOAD_CHART_DAYS days up to today, oldest first.
| void MedicalDesk::onDayEnd | ( | GameData & | gamedata, |
| const GameDateValue & | date, | ||
| TeamID | managed_team_id, | ||
| Inbox & | inbox | ||
| ) |
Closes date (before the calendar moves on, so the day's training and match loads are complete): logs every managed player's load and acute:chronic ratio, forgets players who left and warns once a week per player about load spikes and players selected while injured.
|
private |
| void MedicalDesk::save | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) | const |
Writes the state; must run inside the caller's transaction.
| void MedicalDesk::setFlag | ( | PlayerID | player_id, |
| MedicalFlag | flag, | ||
| bool | enabled | ||
| ) |
|
private |
|
private |
Day of the last warning about each player.