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

The managed club's supporters: their mood is recomputed once a week from the facts and nudges the board's confidence a little. More...

#include <supporters.h>

Public Member Functions

const SupporterMood & mood () const
 
TeamID team () const
 
std::int32_t updatedOn () const
 
void onDayEnd (const GameData &gamedata, const GameDateValue &date, TeamID managed_team_id, const Calendar &calendar, const TransferMarket &transfers, WorldSimulation &world)
 
float update (TeamID new_team_id, std::int32_t day, const SupporterFacts &facts)
 
void load (const std::shared_ptr< DatabaseConnection > &db_conn)
 
void save (const std::shared_ptr< DatabaseConnection > &db_conn) const
 

Static Public Member Functions

static SupporterFacts gather (const GameData &gamedata, const GameDateValue &date, TeamID team_id, const BoardState &board, const Calendar &calendar, const TransferMarket &transfers, std::optional< TeamID > rival)
 

Private Attributes

TeamID team_id = 0
 
std::int32_t updated_day = 0
 
SupporterMood current
 

Detailed Description

The managed club's supporters: their mood is recomputed once a week from the facts and nudges the board's confidence a little.

Persisted in SupporterMood (assets/db/schema.sql) inside the game's save transaction.

Member Function Documentation

◆ gather()

SupporterFacts Supporters::gather ( const GameData &  gamedata,
const GameDateValue &  date,
TeamID  team_id,
const BoardState &  board,
const Calendar &  calendar,
const TransferMarket &  transfers,
std::optional< TeamID >  rival 
)
static

The facts about team_id on date.

◆ load()

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

◆ mood()

const SupporterMood & Supporters::mood ( ) const
inline

The latest weekly mood (meaningful once team() is the managed club).

◆ onDayEnd()

void Supporters::onDayEnd ( const GameData &  gamedata,
const GameDateValue &  date,
TeamID  managed_team_id,
const Calendar &  calendar,
const TransferMarket &  transfers,
WorldSimulation &  world 
)

Closes date: once a week (and at once for a new club) the facts are gathered, the mood moves towards them and the board's confidence is nudged by SupporterModel::boardNudge().

◆ save()

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

Writes the state; must run inside the caller's transaction.

◆ team()

TeamID Supporters::team ( ) const
inline

Club the mood belongs to (0: none yet).

◆ update()

float Supporters::update ( TeamID  new_team_id,
std::int32_t  day,
const SupporterFacts &  facts 
)

Moves the mood of team_id towards the mood facts point to on day (a new club starts there) and returns the board nudge, 0 for a new club.

◆ updatedOn()

std::int32_t Supporters::updatedOn ( ) const
inline

Day ordinal of the latest recomputation.

Member Data Documentation

◆ current

SupporterMood Supporters::current
private

◆ team_id

TeamID Supporters::team_id = 0
private

◆ updated_day

std::int32_t Supporters::updated_day = 0
private

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