Player12
An open source football management simulator
Loading...
Searching...
No Matches
squad_numbers.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 <span>
13
14#include "global/types.h"
15
27namespace SquadNumbers
28{
29inline constexpr int MIN_NUMBER = 1;
30inline constexpr int MAX_NUMBER = 99;
32inline constexpr int YOUNG_AGE = 20;
33
35constexpr bool isValid(int number)
36{
37 return number >= MIN_NUMBER && number <= MAX_NUMBER;
38}
39
41enum class Change : std::uint8_t
42{
43 Changed,
44 Swapped,
45 Invalid
46};
47
49struct Entry
50{
51 PlayerID id = 0;
53 double overall = 0.0;
54 int age = 0;
57 std::uint8_t number = 0;
59 std::uint8_t preferred = 0;
60};
61
71void assign(std::span<Entry> squad);
72} // namespace SquadNumbers
Definition squad_numbers.h:28
Change
Definition squad_numbers.h:42
constexpr bool isValid(int number)
Definition squad_numbers.h:35
constexpr int MAX_NUMBER
Definition squad_numbers.h:30
void assign(std::span< Entry > squad)
Definition squad_numbers.cpp:140
constexpr int YOUNG_AGE
Definition squad_numbers.h:32
constexpr int MIN_NUMBER
Definition squad_numbers.h:29
Definition squad_numbers.h:50
double overall
Definition squad_numbers.h:53
std::uint8_t preferred
Definition squad_numbers.h:59
int age
Definition squad_numbers.h:54
std::uint8_t number
Definition squad_numbers.h:57
PlayerRole role
Definition squad_numbers.h:52
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