57 :
rules(competition_rules)
77 std::vector<DisciplinaryRecord>
records()
const;
78 void restore(
const std::vector<DisciplinaryRecord>& stored);
81 using Key = std::pair<PlayerID, MatchType>;
Yellow-card accumulation and red-card suspensions.
Definition discipline.h:54
std::map< Key, DisciplinaryRecord > by_player
Definition discipline.h:86
DisciplineRules rules
Definition discipline.h:85
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 ...
Definition discipline.cpp:34
void book(DisciplinaryRecord &record, unsigned yellows, unsigned reds) const
Definition discipline.cpp:88
void resetSeason()
Definition discipline.cpp:143
Discipline(DisciplineRules competition_rules={})
Definition discipline.h:56
void restore(const std::vector< DisciplinaryRecord > &stored)
Definition discipline.cpp:162
std::pair< PlayerID, MatchType > Key
Definition discipline.h:81
bool isSuspended(PlayerID player_id, MatchType scope) const
Definition discipline.cpp:118
std::vector< DisciplinaryRecord > records() const
Definition discipline.cpp:154
std::set< Key > active_bans
Definition discipline.h:88
uint8_t banMatches(PlayerID player_id, MatchType scope) const
Definition discipline.cpp:123
std::vector< DisciplinaryRecord > suspendedPlayers(TeamID team_id, const GameData &gamedata) const
Definition discipline.cpp:129
Singleton class that acts as an in-memory cache for the database state.
Definition gamedata.h:43
Cards and outstanding ban of a player in one competition type.
Definition discipline.h:37
uint8_t season_reds
Definition discipline.h:41
uint8_t ban_matches
Definition discipline.h:42
MatchType scope
Definition discipline.h:39
uint16_t season_yellows
Definition discipline.h:40
PlayerID player_id
Definition discipline.h:38
Suspension rules of a competition (every-fifth-yellow style).
Definition discipline.h:27
uint8_t repeat_red_extra
Definition discipline.h:32
uint8_t straight_red_ban
Definition discipline.h:31
uint8_t yellow_accumulation_ban
Definition discipline.h:29
uint8_t second_yellow_ban
Definition discipline.h:30
uint8_t yellow_card_threshold
Definition discipline.h:28
Structured summary of a played fixture, persisted per fixture.
Definition match_report.h:93
MatchType
Represents the type or category of a match.
Definition types.h:40
uint16_t TeamID
Type alias for Team identifiers.
Definition types.h:18
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21