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

Monthly and season honours of every league. More...

#include <awards.h>

Public Member Functions

void onMatchPlayed (const GameData &gamedata, const MatchReport &report, float home_expected, float away_expected)
 
std::vector< AwardRecord > onMonthStart (GameData &gamedata, const GameDateValue &date, TeamID managed_team_id, Inbox &inbox, BoardState &board)
 
std::vector< AwardRecord > awardMonth (const GameData &gamedata, std::uint16_t season_year, std::uint8_t month)
 
std::vector< AwardRecord > awardSeason (const GameData &gamedata, std::uint16_t season_year)
 
const std::vector< AwardRecord > & history () const
 
std::vector< AwardRecord > honoursFor (PlayerID player_id) const
 
std::vector< AwardRecord > forLeague (LeagueID league_id, std::uint16_t season_year) const
 
int seasonHonours (PlayerID player_id, TeamID team_id) const
 
float valueMultiplier (PlayerID player_id, const GameDateValue &today) const
 
const std::map< std::pair< LeagueID, PlayerID >, AwardPlayerTally > & seasonTallies () const
 
const std::map< std::pair< LeagueID, PlayerID >, AwardPlayerTally > & monthTallies () const
 
void clear ()
 
void load (const std::shared_ptr< DatabaseConnection > &db_conn)
 
void save (const std::shared_ptr< DatabaseConnection > &db_conn) const
 

Private Types

using PlayerTallies = std::map< std::pair< LeagueID, PlayerID >, AwardPlayerTally >
 
using ClubTallies = std::map< TeamID, AwardClubTally >
 

Private Member Functions

std::vector< AwardCandidate > candidates (const GameData &gamedata, const PlayerTallies &tallies, LeagueID league_id) const
 
void addRecord (const GameData &gamedata, AwardRecord record, std::vector< AwardRecord > &given)
 

Private Attributes

std::vector< AwardRecord > records
 
PlayerTallies month_players
 
PlayerTallies season_players
 
ClubTallies month_clubs
 
ClubTallies season_clubs
 
std::map< LeagueID, GoalCandidate > month_goals
 

Detailed Description

Monthly and season honours of every league.

Tallies league matches as they are played and hands out the monthly awards on the first day of the next month and the season awards on 1 June, when every league has finished. The history is kept for the whole career. Winners gain morale; the managed club's manager awards please the board; the Manager of the Season's club gains a reputation point.

Member Typedef Documentation

◆ ClubTallies

using AwardSystem::ClubTallies = std::map<TeamID, AwardClubTally>
private

◆ PlayerTallies

using AwardSystem::PlayerTallies = std::map<std::pair<LeagueID, PlayerID>, AwardPlayerTally>
private

Member Function Documentation

◆ addRecord()

void AwardSystem::addRecord ( const GameData &  gamedata,
AwardRecord  record,
std::vector< AwardRecord > &  given 
)
private

◆ awardMonth()

std::vector< AwardRecord > AwardSystem::awardMonth ( const GameData &  gamedata,
std::uint16_t  season_year,
std::uint8_t  month 
)

Monthly awards of the tallies collected so far (clears them).

◆ awardSeason()

std::vector< AwardRecord > AwardSystem::awardSeason ( const GameData &  gamedata,
std::uint16_t  season_year 
)

Season awards of the tallies collected so far (clears them).

◆ candidates()

std::vector< AwardCandidate > AwardSystem::candidates ( const GameData &  gamedata,
const PlayerTallies &  tallies,
LeagueID  league_id 
) const
private

◆ clear()

void AwardSystem::clear ( )

◆ forLeague()

std::vector< AwardRecord > AwardSystem::forLeague ( LeagueID  league_id,
std::uint16_t  season_year 
) const

Honours given in a league in a season (all months), in award order.

◆ history()

const std::vector< AwardRecord > & AwardSystem::history ( ) const
inline

Every honour, oldest first.

◆ honoursFor()

std::vector< AwardRecord > AwardSystem::honoursFor ( PlayerID  player_id) const

Honours of a player, newest first.

◆ load()

void AwardSystem::load ( const std::shared_ptr< DatabaseConnection > &  db_conn)

◆ monthTallies()

const std::map< std::pair< LeagueID, PlayerID >, AwardPlayerTally > & AwardSystem::monthTallies ( ) const
inline

◆ onMatchPlayed()

void AwardSystem::onMatchPlayed ( const GameData &  gamedata,
const MatchReport &  report,
float  home_expected,
float  away_expected 
)

Adds a league match (ratings already set).

◆ onMonthStart()

std::vector< AwardRecord > AwardSystem::onMonthStart ( GameData &  gamedata,
const GameDateValue &  date,
TeamID  managed_team_id,
Inbox &  inbox,
BoardState &  board 
)

First day of a month: awards the previous month (and on 1 June the season), applies the effects and posts the managed league's news.

Returns
The honours given today.

◆ save()

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

◆ seasonHonours()

int AwardSystem::seasonHonours ( PlayerID  player_id,
TeamID  team_id 
) const

Individual season honours won by a player at a club.

◆ seasonTallies()

const std::map< std::pair< LeagueID, PlayerID >, AwardPlayerTally > & AwardSystem::seasonTallies ( ) const
inline

◆ valueMultiplier()

float AwardSystem::valueMultiplier ( PlayerID  player_id,
const GameDateValue &  today 
) const

Market value multiplier of a player (see Awards::valueMultiplier).

Member Data Documentation

◆ month_clubs

ClubTallies AwardSystem::month_clubs
private

◆ month_goals

std::map<LeagueID, GoalCandidate> AwardSystem::month_goals
private

◆ month_players

PlayerTallies AwardSystem::month_players
private

◆ records

std::vector<AwardRecord> AwardSystem::records
private

◆ season_clubs

ClubTallies AwardSystem::season_clubs
private

◆ season_players

PlayerTallies AwardSystem::season_players
private

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