|
Player12
An open source football management simulator
|
Formation presets and XI selection built on the Lineup API. More...
Classes | |
| struct | Preset |
| A named arrangement of ten outfield slots. More... | |
| struct | Slot |
| One outfield slot of a formation. More... | |
Functions | |
| float | roleFit (PlayerRole actual, PlayerRole expected) |
| How well a player's natural role suits a slot role, in [0, 1]. 1 means natural; adjacent roles score partially; goalkeepers and outfield players never swap. | |
| void | applyPreset (Lineup &lineup, const Preset &preset, const StatsConfig &config) |
| Moves the current outfield players into the preset's slots, keeping the same eleven and matching players to the slots that suit them best. | |
| void | autoPick (Lineup &lineup, const Preset &preset, std::span< const Player *const > squad, const StatsConfig &config) |
| Chooses the best goalkeeper and ten outfield players from the squad for the preset, places them, and puts everyone else on the bench. | |
| void | autoPickAvailable (Lineup &lineup, const Preset &preset, std::span< const Player *const > squad, const std::unordered_set< PlayerID > &unavailable, const StatsConfig &config) |
| autoPick() that leaves unavailable players (injured, suspended) out of the matchday squad (the lineup screen lists them with the rest). | |
| size_t | unavailableStarters (const Lineup &lineup, const std::unordered_set< PlayerID > &unavailable) |
| Selected starters (goalkeeper and outfield) found in the set. | |
| int | detectPreset (const Lineup &lineup) |
| Index of the preset matching the current positions, or -1 when the shape has been customised. | |
Variables | |
| const std::array< Preset, 5 > | PRESETS |
| 4-4-2, 4-3-3, 4-2-3-1, 3-5-2 and 5-3-2. | |
Formation presets and XI selection built on the Lineup API.
Pitch coordinates follow Lineup: x runs from the own goal (0) to the opponent's goal (1), y from the left touchline (0) to the right (1).
| void Formation::applyPreset | ( | Lineup & | lineup, |
| const Preset & | preset, | ||
| const StatsConfig & | config | ||
| ) |
Moves the current outfield players into the preset's slots, keeping the same eleven and matching players to the slots that suit them best.
| void Formation::autoPick | ( | Lineup & | lineup, |
| const Preset & | preset, | ||
| std::span< const Player *const > | squad, | ||
| const StatsConfig & | config | ||
| ) |
Chooses the best goalkeeper and ten outfield players from the squad for the preset, places them, and puts everyone else on the bench.
| void Formation::autoPickAvailable | ( | Lineup & | lineup, |
| const Preset & | preset, | ||
| std::span< const Player *const > | squad, | ||
| const std::unordered_set< PlayerID > & | unavailable, | ||
| const StatsConfig & | config | ||
| ) |
autoPick() that leaves unavailable players (injured, suspended) out of the matchday squad (the lineup screen lists them with the rest).
| int Formation::detectPreset | ( | const Lineup & | lineup | ) |
Index of the preset matching the current positions, or -1 when the shape has been customised.
| float Formation::roleFit | ( | PlayerRole | actual, |
| PlayerRole | expected | ||
| ) |
How well a player's natural role suits a slot role, in [0, 1]. 1 means natural; adjacent roles score partially; goalkeepers and outfield players never swap.
| size_t Formation::unavailableStarters | ( | const Lineup & | lineup, |
| const std::unordered_set< PlayerID > & | unavailable | ||
| ) |
Selected starters (goalkeeper and outfield) found in the set.