|
Player12
An open source football management simulator
|
Yellow-card accumulation and red-card suspensions. More...
#include <discipline.h>
Public Member Functions | |
| Discipline (DisciplineRules competition_rules={}) | |
| void | processMatch (const MatchReport &report, const GameData &gamedata) |
| Serves one match of every ban of the two teams, then books the cards of this match (so a red card is not served by the same match). | |
| bool | isSuspended (PlayerID player_id, MatchType scope) const |
| uint8_t | banMatches (PlayerID player_id, MatchType scope) const |
| std::vector< DisciplinaryRecord > | suspendedPlayers (TeamID team_id, const GameData &gamedata) const |
| void | resetSeason () |
| std::vector< DisciplinaryRecord > | records () const |
| void | restore (const std::vector< DisciplinaryRecord > &stored) |
Private Types | |
| using | Key = std::pair< PlayerID, MatchType > |
Private Member Functions | |
| void | book (DisciplinaryRecord &record, unsigned yellows, unsigned reds) const |
Private Attributes | |
| DisciplineRules | rules |
| std::map< Key, DisciplinaryRecord > | by_player |
| std::set< Key > | active_bans |
Yellow-card accumulation and red-card suspensions.
League and cup are separate scopes: cards collected in one are served in the same competition type. Friendlies never count. Card counts reset every season; outstanding bans carry over.
|
private |
|
inlineexplicit |
|
private |
| void Discipline::processMatch | ( | const MatchReport & | report, |
| const GameData & | gamedata | ||
| ) |
Serves one match of every ban of the two teams, then books the cards of this match (so a red card is not served by the same match).
| std::vector< DisciplinaryRecord > Discipline::records | ( | ) | const |
| void Discipline::resetSeason | ( | ) |
Clears the season card counts; outstanding bans are kept.
| void Discipline::restore | ( | const std::vector< DisciplinaryRecord > & | stored | ) |
| std::vector< DisciplinaryRecord > Discipline::suspendedPlayers | ( | TeamID | team_id, |
| const GameData & | gamedata | ||
| ) | const |
Players of a team with an outstanding ban (any scope).
|
private |
Records with ban_matches > 0, so serving bans skips everyone else.
|
private |
|
private |