Player12
An open source football management simulator
Loading...
Searching...
No Matches
MatchdaySquad Namespace Reference

Typedefs

using Eligibility = std::function< bool(const Player &)>
 

Functions

std::vector< PlayerID > ineligible (const Lineup &lineup, const Eligibility &eligible)
 
float slotScore (const Player &player, PlayerRole slot, const StatsConfig &config)
 
std::size_t replaceIneligible (Lineup &lineup, std::span< const Player *const > squad, const Eligibility &eligible, const StatsConfig &config)
 
std::size_t recallRegulars (Lineup &lineup, std::span< const Player *const > squad, const Eligibility &eligible, const StatsConfig &config)
 
void recordStandIns (const Lineup &before, Lineup &after)
 
std::vector< std::pair< PlayerID, PlayerID > > replacements (const Lineup &before, const Lineup &after)
 
void carryCondition (MatchEngine &engine, const Lineup &lineup)
 
std::vector< PlayerMatchConsequence > consequences (const MatchEngine &engine)
 
std::vector< std::pair< PlayerID, std::uint8_t > > medicalFlags (const MedicalDesk &medical, const Lineup &lineup)
 

Detailed Description

Selection rules shared by live and simulated matches: who may take part, how an ineligible selection is replaced, and how the players' persistent physical state enters and leaves the match engine.

Typedef Documentation

◆ Eligibility

using MatchdaySquad::Eligibility = typedef std::function<bool(const Player&)>
private

Function Documentation

◆ carryCondition()

void MatchdaySquad::carryCondition ( MatchEngine &  engine,
const Lineup &  lineup 
)
private

Starts the matchday squad (starters and substitutes) with its persistent condition (0-100).

◆ consequences()

std::vector< PlayerMatchConsequence > MatchdaySquad::consequences ( const MatchEngine &  engine)
private

Minutes, end condition (0-100) and injuries of every participant.

◆ ineligible()

std::vector< PlayerID > MatchdaySquad::ineligible ( const Lineup &  lineup,
const Eligibility &  eligible 
)
private

Selected players (goalkeeper, outfield, then reserves) who may not play.

◆ medicalFlags()

std::vector< std::pair< PlayerID, std::uint8_t > > MatchdaySquad::medicalFlags ( const MedicalDesk &  medical,
const Lineup &  lineup 
)
private

Medical staff instructions set for the matchday squad (starters and substitutes), for MatchEngine::setMedicalFlags.

◆ recallRegulars()

std::size_t MatchdaySquad::recallRegulars ( Lineup &  lineup,
std::span< const Player *const >  squad,
const Eligibility &  eligible,
const StatsConfig &  config 
)
private

Puts the regulars of Lineup::getStandIns() who may play again back in place of their stand-ins: from the bench the two swap, from outside the matchday squad the regular takes the stand-in's place. While a regular is still out, an eligible player who fills the slot clearly better (slotScore) replaces his stand-in. Entries whose regular already starts, whose stand-in no longer does or whose regular is not in squad are dropped. Returns the number of regulars recalled.

◆ recordStandIns()

void MatchdaySquad::recordStandIns ( const Lineup &  before,
Lineup &  after 
)
private

Notes in after the starters who replaced a starter of before, slot by slot. A stand-in replaced in turn hands his entry on, so the regular is the one who returns.

◆ replaceIneligible()

std::size_t MatchdaySquad::replaceIneligible ( Lineup &  lineup,
std::span< const Player *const >  squad,
const Eligibility &  eligible,
const StatsConfig &  config 
)
private

Replaces ineligible starters with the eligible substitute or unselected squad player who fits the slot best (slotScore; a keeper for the goalkeeper slot, an outfield player only when no keeper is left) and ineligible reserves with the best remaining squad players. Returns the number of players replaced.

◆ replacements()

std::vector< std::pair< PlayerID, PlayerID > > MatchdaySquad::replacements ( const Lineup &  before,
const Lineup &  after 
)
private

Who replaced whom between two selections of the same team: starters slot by slot, then reserves that left the squad (replacement 0).

◆ slotScore()

float MatchdaySquad::slotScore ( const Player &  player,
PlayerRole  slot,
const StatsConfig &  config 
)
private

How well player fills a slot asking for slot: his overall scaled by the fit of his position (1 for his own, less for neighbouring ones).