|
Player12
An open source football management simulator
|
Statuses the manager gave players of his club. More...
#include <squad_status.h>
Classes | |
| struct | Entry |
Public Member Functions | |
| void | set (PlayerID player_id, TeamID team_id, std::optional< SquadStatus > status) |
| std::optional< SquadStatus > | get (PlayerID player_id, TeamID current_team_id) const |
| std::size_t | size () const |
| template<typename TeamOf > | |
| void | prune (TeamOf &&team_of) |
| void | load (const DatabaseConnection &db_conn) |
| void | save (const DatabaseConnection &db_conn) const |
Private Attributes | |
| std::unordered_map< PlayerID, Entry > | entries |
Statuses the manager gave players of his club.
An entry only counts while the player is still at the club that set it, so transfers and a change of club reset statuses without bookkeeping.
| std::optional< SquadStatus > SquadStatusBook::get | ( | PlayerID | player_id, |
| TeamID | current_team_id | ||
| ) | const |
Status of a player who still plays for current_team_id.
| void SquadStatusBook::load | ( | const DatabaseConnection & | db_conn | ) |
Replaces the book with the SquadStatuses table.
|
inline |
Drops entries whose player no longer plays for the club that set them.
| void SquadStatusBook::save | ( | const DatabaseConnection & | db_conn | ) | const |
Rewrites the SquadStatuses table (inside the caller's transaction).
| void SquadStatusBook::set | ( | PlayerID | player_id, |
| TeamID | team_id, | ||
| std::optional< SquadStatus > | status | ||
| ) |
Sets (or with nullopt clears) the status of a player of team_id.
|
inline |
Number of stored entries (stale ones included until pruned).