Player12
An open source football management simulator
Loading...
Searching...
No Matches
roles.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_view>
13#include <unordered_map>
14
19enum class Role : uint8_t
20{
21 GKP,
22 CB,
23 LB,
24 RB,
25 LWB,
26 RWB,
27 CDM,
28 CM,
29 CAM,
30 LM,
31 RM,
32 LWM,
33 RWM,
34 ST,
35 CF,
36 LW,
37 RW,
38 LF,
39 RF
40};
41
46inline const std::unordered_map<std::string_view, Role> strToRole{
47 {"GKP", Role::GKP}, {"CB", Role::CB}, {"LB", Role::LB},
48 {"RB", Role::RB}, {"LWB", Role::LWB}, {"RWB", Role::RWB},
49 {"CDM", Role::CDM}, {"CM", Role::CM}, {"CAM", Role::CAM},
50 {"LM", Role::LM}, {"RM", Role::RM}, {"LWM", Role::LWM},
51 {"RWM", Role::RWM}, {"ST", Role::ST}, {"CF", Role::CF},
52 {"LW", Role::LW}, {"RW", Role::RW}, {"LF", Role::LF},
53 {"RF", Role::RF}};
54
58inline const std::unordered_map<Role, std::string_view> roleToStr{
59 {Role::GKP, "GKP"}, {Role::CB, "CB"}, {Role::LB, "LB"},
60 {Role::RB, "RB"}, {Role::LWB, "LWB"}, {Role::RWB, "RWB"},
61 {Role::CDM, "CDM"}, {Role::CM, "CM"}, {Role::CAM, "CAM"},
62 {Role::LM, "LM"}, {Role::RM, "RM"}, {Role::LWM, "LWM"},
63 {Role::RWM, "RWM"}, {Role::ST, "ST"}, {Role::CF, "CF"},
64 {Role::LW, "LW"}, {Role::RW, "RW"}, {Role::LF, "LF"},
65 {Role::RF, "RF"}};
Role
Represents the positional role of a player on the field.
Definition roles.h:20
const std::unordered_map< Role, std::string_view > roleToStr
Maps a Role enum value to its string representation.
Definition roles.h:58
const std::unordered_map< std::string_view, Role > strToRole
Maps a string representation of a role to its Role enum value. Used for parsing input.
Definition roles.h:46