Player12
An open source football management simulator
Loading...
Searching...
No Matches
match_events.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <cstdint>
12#include <string>
13#include <string_view>
14
15#include "global/types.h"
16#include "model/match_tuning.h"
17
19enum class MatchEventType : std::uint8_t
20{
21 INFO,
23 GOAL,
25 SHOT,
26 SAVE,
30 FOUL,
35 INJURY,
37 OFFSIDE,
38 CORNER,
40 PENALTY,
51};
52
53std::string_view matchEventTypeName(MatchEventType type);
54
56enum class MatchEventDetail : std::uint8_t
57{
58 NONE,
60 HEADER,
62 PARRIED,
65 WALL,
67 CONTACT,
71 SCORED,
72 SAVED,
73 MISSED
74};
75
115
122{
124 bool isHomeTeam = false;
126 bool started = false;
127 bool substitutedOn = false;
128 bool substitutedOff = false;
129 bool sentOff = false;
130 bool injured = false;
131 float minutesPlayed = 0.0f;
132 int goals = 0;
133 int ownGoals = 0;
134 int assists = 0;
135 int shots = 0;
137 float expectedGoals = 0.0f;
140 int keyPasses = 0;
142 int tacklesWon = 0;
144 int clearances = 0;
147 int saves = 0;
151 int yellowCards = 0;
152 int redCards = 0;
154 int touches = 0;
156 int pressures = 0;
158 float distanceMetres = 0.0f;
163 float sprintMetres = 0.0f;
165 int sprints = 0;
167 float topSpeed = 0.0f;
169 float condition = 1.0f;
172};
173
174enum class SubstitutionReason : std::uint8_t
175{
176 MANUAL,
177 FATIGUE,
178 INJURY,
179 TACTICAL,
180 CARD_RISK,
182};
183
MatchEventType
Definition match_events.h:20
std::string_view matchEventTypeName(MatchEventType type)
Definition match_rules.cpp:14
MatchEventDetail
Definition match_events.h:57
SubstitutionReason
Definition match_events.h:175
Definition match_events.h:93
int awayScore
Definition match_events.h:108
PlayerID secondaryPlayerId
Definition match_events.h:102
float xg
Definition match_events.h:104
float addedMinute
Definition match_events.h:98
bool isHomeTeam
Definition match_events.h:100
Vector2F position
Definition match_events.h:103
PlayerID primaryPlayerId
Definition match_events.h:101
float timeMinute
Definition match_events.h:94
std::string description
Definition match_events.h:95
MatchEventType type
Definition match_events.h:96
int homeScore
Definition match_events.h:107
MatchEventDetail detail
Definition match_events.h:105
int period
Definition match_events.h:97
int homeShootout
Definition match_events.h:112
int awayShootout
Definition match_events.h:113
int minutes
Definition match_events.h:110
bool hasTeam
Definition match_events.h:99
Definition match_events.h:185
SubstitutionReason reason
Definition match_events.h:191
PlayerID incomingPlayerId
Definition match_events.h:190
bool isHomeTeam
Definition match_events.h:188
int period
Definition match_events.h:187
float timeMinute
Definition match_events.h:186
PlayerID outgoingPlayerId
Definition match_events.h:189
static constexpr float CENTRE
Definition match_tuning.h:37
static constexpr float BASELINE
Definition match_tuning.h:908
Definition match_events.h:122
int pressures
Definition match_events.h:156
int shotsOnTarget
Definition match_events.h:136
float distanceMetres
Definition match_events.h:158
float secondHalfHighIntensityMetres
Definition match_events.h:162
int sprints
Definition match_events.h:165
int clearances
Definition match_events.h:144
int touches
Definition match_events.h:154
PlayerRole role
Definition match_events.h:125
bool injured
Definition match_events.h:130
int ownGoals
Definition match_events.h:133
float sprintMetres
Definition match_events.h:163
float secondHalfDistanceMetres
Definition match_events.h:159
int foulsSuffered
Definition match_events.h:150
bool sentOff
Definition match_events.h:129
bool substitutedOff
Definition match_events.h:128
int redCards
Definition match_events.h:152
int goals
Definition match_events.h:132
int goalsConceded
Definition match_events.h:148
PlayerID playerId
Definition match_events.h:123
bool started
Definition match_events.h:126
bool substitutedOn
Definition match_events.h:127
int foulsCommitted
Definition match_events.h:149
int interceptions
Definition match_events.h:143
int yellowCards
Definition match_events.h:151
int aerialDuelsWon
Definition match_events.h:145
int keyPasses
Definition match_events.h:140
int saves
Definition match_events.h:147
int tacklesAttempted
Definition match_events.h:141
int passesCompleted
Definition match_events.h:139
int passesAttempted
Definition match_events.h:138
int shots
Definition match_events.h:135
int assists
Definition match_events.h:134
float condition
Definition match_events.h:169
float topSpeed
Definition match_events.h:167
float expectedGoals
Definition match_events.h:137
int tacklesWon
Definition match_events.h:142
bool isHomeTeam
Definition match_events.h:124
int aerialDuelsLost
Definition match_events.h:146
float rating
Definition match_events.h:171
float minutesPlayed
Definition match_events.h:131
float highIntensityMetres
Definition match_events.h:161
A simple 2D float vector for pitch coordinates.
Definition types.h:84
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21
PlayerRole
Represents a specific tactical role on the pitch.
Definition types.h:63