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

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
 

Detailed Description

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.

Member Typedef Documentation

◆ RecordKey

using RecordBook::RecordKey = std::tuple<RecordScope, std::uint32_t, RecordKind>
private

Member Function Documentation

◆ allTimeTable()

std::vector< AllTimeRow > RecordBook::allTimeTable ( LeagueID  league_id) const

All-time league table, most points first.

◆ clear()

void RecordBook::clear ( )

◆ closeSeason()

void RecordBook::closeSeason ( const GameData &  gamedata,
std::uint16_t  season_year 
)

Settles the season records of season_year and starts a new season.

◆ clubRecords()

std::vector< RecordEntry > RecordBook::clubRecords ( TeamID  team_id) const

Records of a club / league in RecordKind order (only those set).

◆ hallOfFame()

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.

◆ leagueRecords()

std::vector< RecordEntry > RecordBook::leagueRecords ( LeagueID  league_id) const

◆ load()

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.

◆ mostAppearances()

std::vector< ClubPlayerTotal > RecordBook::mostAppearances ( TeamID  team_id,
std::size_t  limit 
) const

◆ offer()

void RecordBook::offer ( RecordEntry  entry)
private

◆ onMatchPlayed()

void RecordBook::onMatchPlayed ( const GameData &  gamedata,
const MatchReport &  report 
)

Adds a competitive match (attendance already set).

◆ onTransfer()

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.

◆ rebuild()

void RecordBook::rebuild ( const std::shared_ptr< DatabaseConnection > &  db_conn,
const GameData &  gamedata 
)
private

◆ save()

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

◆ topScorers()

std::vector< ClubPlayerTotal > RecordBook::topScorers ( TeamID  team_id,
std::size_t  limit 
) const

A club's all-time scorers / appearance makers, best first.

Member Data Documentation

◆ all_time

std::map<std::pair<LeagueID, TeamID>, AllTimeRow> RecordBook::all_time
private

◆ club_players

std::map<std::pair<TeamID, PlayerID>, ClubPlayerTotal> RecordBook::club_players
private

◆ records

std::map<RecordKey, RecordEntry> RecordBook::records
private

◆ season_scorers

std::map<std::pair<TeamID, PlayerID>, std::uint16_t> RecordBook::season_scorers
private

◆ season_teams

std::map<TeamID, SeasonTeam> RecordBook::season_teams
private

◆ season_year

std::uint16_t RecordBook::season_year = 0
private

Season of season_teams/scorers.


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