Player12
An open source football management simulator
Loading...
Searching...
No Matches
MatchReport Struct Reference

Structured summary of a played fixture, persisted per fixture. More...

#include <match_report.h>

Public Member Functions

void fillFromEngine (const MatchEngine &engine, TeamID home_id, TeamID away_id)
 
void addLineupAppearances (const Lineup &lineup, TeamID team_id)
 
void creditExtraTimeGoals (const Lineup &lineup, TeamID team_id, bool home, uint8_t goals, uint32_t seed)
 
std::string eventsToJson () const
 
std::string playersToJson () const
 
std::string statsToJson () const
 
void eventsFromJson (const std::string &json)
 
void playersFromJson (const std::string &json)
 
void statsFromJson (const std::string &json)
 

Public Attributes

GameDateValue date
 
TeamID home_team_id = 0
 
TeamID away_team_id = 0
 
MatchType match_type = MatchType::LEAGUE
 
LeagueID competition_id = 0
 
uint8_t stage = 0
 
uint16_t season = 0
 
uint8_t home_goals = 0
 
uint8_t away_goals = 0
 
bool extra_time = false
 
bool penalties = false
 
uint8_t home_penalties = 0
 
uint8_t away_penalties = 0
 
uint32_t attendance = 0
 
TeamMatchStats home_stats
 
TeamMatchStats away_stats
 
std::vector< MatchReportEvent > events
 
std::vector< PlayerMatchLine > players
 
std::optional< bool > played_home
 
float played_share = 0.0f
 

Detailed Description

Structured summary of a played fixture, persisted per fixture.

Fixtures are identified by (date, home team, away team). Scores include extra-time goals; penalties are reported separately.

Member Function Documentation

◆ addLineupAppearances()

void MatchReport::addLineupAppearances ( const Lineup &  lineup,
TeamID  team_id 
)

Records the starters of a lineup as having played the full match (used when no per-player engine data exists, e.g. score-only results).

◆ creditExtraTimeGoals()

void MatchReport::creditExtraTimeGoals ( const Lineup &  lineup,
TeamID  team_id,
bool  home,
uint8_t  goals,
uint32_t  seed 
)

Credits goals extra-time goals of one side when extra time was resolved statistically (Competitions::resolveDrawnKnockout, the fallback for a tie recorded level without the engine playing it): each goal is given to a player of lineup who finished the match, drawn from seed with forwards and good finishers favoured: it counts on his line and becomes a GOAL event between minutes 91 and 120. When the side has nobody left to credit, the event has no player (a team goal).

◆ eventsFromJson()

void MatchReport::eventsFromJson ( const std::string &  json)

◆ eventsToJson()

std::string MatchReport::eventsToJson ( ) const

◆ fillFromEngine()

void MatchReport::fillFromEngine ( const MatchEngine &  engine,
TeamID  home_id,
TeamID  away_id 
)

Copies the engine's final score, team totals, per-player lines and the scorer/card events.

◆ playersFromJson()

void MatchReport::playersFromJson ( const std::string &  json)

◆ playersToJson()

std::string MatchReport::playersToJson ( ) const

◆ statsFromJson()

void MatchReport::statsFromJson ( const std::string &  json)

◆ statsToJson()

std::string MatchReport::statsToJson ( ) const

Member Data Documentation

◆ attendance

uint32_t MatchReport::attendance = 0

0 until stadiums/attendance are modelled.

◆ away_goals

uint8_t MatchReport::away_goals = 0

◆ away_penalties

uint8_t MatchReport::away_penalties = 0

◆ away_stats

TeamMatchStats MatchReport::away_stats

◆ away_team_id

TeamID MatchReport::away_team_id = 0

◆ competition_id

LeagueID MatchReport::competition_id = 0

◆ date

GameDateValue MatchReport::date

◆ events

std::vector<MatchReportEvent> MatchReport::events

◆ extra_time

bool MatchReport::extra_time = false

◆ home_goals

uint8_t MatchReport::home_goals = 0

◆ home_penalties

uint8_t MatchReport::home_penalties = 0

◆ home_stats

TeamMatchStats MatchReport::home_stats

◆ home_team_id

TeamID MatchReport::home_team_id = 0

◆ match_type

MatchType MatchReport::match_type = MatchType::LEAGUE

◆ penalties

bool MatchReport::penalties = false

◆ played_home

std::optional<bool> MatchReport::played_home

Play mode: the side the manager played himself on the pitch (empty when the match was watched or simulated) and his share of that side's passes, shots and tackles in [0, 1]. Stored with the team statistics.

◆ played_share

float MatchReport::played_share = 0.0f

◆ players

std::vector<PlayerMatchLine> MatchReport::players

◆ season

uint16_t MatchReport::season = 0

◆ stage

uint8_t MatchReport::stage = 0

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