|
Player12
An open source football management simulator
|
Club and league records, club player totals, all-time tables and the hall of fame. More...
#include <records.h>
Classes | |
| struct | SeasonTeam |
Public Member Functions | |
| void | onMatchPlayed (const GameData &gamedata, const MatchReport &report) |
| void | onTransfer (const GameData &gamedata, const GameDateValue &date, PlayerID player_id, TeamID from_team_id, TeamID to_team_id, std::uint32_t fee) |
| void | closeSeason (const GameData &gamedata, std::uint16_t season_year) |
| std::vector< RecordEntry > | clubRecords (TeamID team_id) const |
| std::vector< RecordEntry > | leagueRecords (LeagueID league_id) const |
| std::vector< ClubPlayerTotal > | topScorers (TeamID team_id, std::size_t limit) const |
| std::vector< ClubPlayerTotal > | mostAppearances (TeamID team_id, std::size_t limit) const |
| std::vector< AllTimeRow > | allTimeTable (LeagueID league_id) const |
| std::vector< LegendEntry > | hallOfFame (TeamID team_id, const std::function< int(PlayerID, TeamID)> &honours) const |
| void | clear () |
| void | load (const std::shared_ptr< DatabaseConnection > &db_conn, const GameData &gamedata) |
| void | save (const std::shared_ptr< DatabaseConnection > &db_conn) const |
Private Types | |
| using | RecordKey = std::tuple< RecordScope, std::uint32_t, RecordKind > |
Private Member Functions | |
| void | offer (RecordEntry entry) |
| void | rebuild (const std::shared_ptr< DatabaseConnection > &db_conn, const GameData &gamedata) |
Private Attributes | |
| std::map< RecordKey, RecordEntry > | records |
| std::map< std::pair< TeamID, PlayerID >, ClubPlayerTotal > | club_players |
| std::map< std::pair< LeagueID, TeamID >, AllTimeRow > | all_time |
| std::map< TeamID, SeasonTeam > | season_teams |
| std::map< std::pair< TeamID, PlayerID >, std::uint16_t > | season_scorers |
| std::uint16_t | season_year = 0 |
Club and league records, club player totals, all-time tables and the hall of fame.
Updated incrementally from every competitive match report and completed transfer; season records are settled when the season closes. Friendlies never count. Old saves are rebuilt once from the stored match reports and transfer history.
|
private |
| std::vector< AllTimeRow > RecordBook::allTimeTable | ( | LeagueID | league_id | ) | const |
All-time league table, most points first.
| void RecordBook::clear | ( | ) |
| void RecordBook::closeSeason | ( | const GameData & | gamedata, |
| std::uint16_t | season_year | ||
| ) |
Settles the season records of season_year and starts a new season.
| std::vector< RecordEntry > RecordBook::clubRecords | ( | TeamID | team_id | ) | const |
Records of a club / league in RecordKind order (only those set).
| std::vector< LegendEntry > RecordBook::hallOfFame | ( | TeamID | team_id, |
| const std::function< int(PlayerID, TeamID)> & | honours | ||
| ) | const |
Legends of a club, best first. honours counts a player's individual season awards at the club.
| std::vector< RecordEntry > RecordBook::leagueRecords | ( | LeagueID | league_id | ) | const |
| void RecordBook::load | ( | const std::shared_ptr< DatabaseConnection > & | db_conn, |
| const GameData & | gamedata | ||
| ) |
Loads the book; a save written before it existed is rebuilt from the stored match reports and transfer history.
| std::vector< ClubPlayerTotal > RecordBook::mostAppearances | ( | TeamID | team_id, |
| std::size_t | limit | ||
| ) | const |
|
private |
| void RecordBook::onMatchPlayed | ( | const GameData & | gamedata, |
| const MatchReport & | report | ||
| ) |
Adds a competitive match (attendance already set).
| void RecordBook::onTransfer | ( | const GameData & | gamedata, |
| const GameDateValue & | date, | ||
| PlayerID | player_id, | ||
| TeamID | from_team_id, | ||
| TeamID | to_team_id, | ||
| std::uint32_t | fee | ||
| ) |
A completed move with a fee: record signing / sale.
|
private |
| void RecordBook::save | ( | const std::shared_ptr< DatabaseConnection > & | db_conn | ) | const |
| std::vector< ClubPlayerTotal > RecordBook::topScorers | ( | TeamID | team_id, |
| std::size_t | limit | ||
| ) | const |
A club's all-time scorers / appearance makers, best first.
|
private |
|
private |
|
private |
|
private |
|
private |
Season of season_teams/scorers.