Player12
An open source football management simulator
Loading...
Searching...
No Matches
delegation.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 <array>
12#include <cstddef>
13#include <cstdint>
14#include <optional>
15#include <utility>
16
22enum class Duty : std::uint8_t
23{
24 LineupFixes = 0,
31 COUNT
32};
33
34inline constexpr std::size_t DUTY_COUNT =
35 static_cast<std::size_t>(std::to_underlying(Duty::COUNT));
36
38enum class DutyOwner : std::uint8_t
39{
40 Manager = 0,
42};
43
45enum class DelegationPreset : std::uint8_t
46{
47 HandsOn = 0,
48 Balanced,
50 COUNT
51};
52
61{
62 public:
65
68
69 DutyOwner owner(Duty duty) const;
70 bool delegated(Duty duty) const
71 {
72 return owner(duty) == DutyOwner::Assistant;
73 }
75 bool set(Duty duty, DutyOwner owner);
79 std::optional<DelegationPreset> matchingPreset() const;
80
81 const std::array<DutyOwner, DUTY_COUNT>& owners() const { return duties; }
82
83 bool operator==(const DelegationPolicy&) const = default;
84
85 private:
86 std::array<DutyOwner, DUTY_COUNT> duties{};
87};
88
90const char* dutyKey(Duty duty);
92const char* dutyHelpKey(Duty duty);
94const char* delegationPresetKey(DelegationPreset preset);
Who handles each duty of the managed club.
Definition delegation.h:61
DutyOwner owner(Duty duty) const
Definition delegation.cpp:60
bool delegated(Duty duty) const
Definition delegation.h:70
std::optional< DelegationPreset > matchingPreset() const
Definition delegation.cpp:81
static DelegationPolicy preset(DelegationPreset preset)
Definition delegation.cpp:53
bool operator==(const DelegationPolicy &) const =default
void apply(DelegationPreset preset)
Definition delegation.cpp:74
const std::array< DutyOwner, DUTY_COUNT > & owners() const
Definition delegation.h:81
bool set(Duty duty, DutyOwner owner)
Definition delegation.cpp:66
std::array< DutyOwner, DUTY_COUNT > duties
Definition delegation.h:86
DelegationPolicy()
Definition delegation.cpp:47
constexpr std::size_t DUTY_COUNT
Definition delegation.h:34
DelegationPreset
Named delegation profiles offered on the delegation screen.
Definition delegation.h:46
const char * dutyKey(Duty duty)
Definition delegation.cpp:90
DutyOwner
Who takes care of a duty (values are persisted).
Definition delegation.h:39
Duty
Recurring jobs the manager may hand to the backroom staff.
Definition delegation.h:23
@ LineupFixes
@ YouthContracts
@ ScoutingAssignments
@ Substitutions
@ TrainingSchedule
@ Friendlies
@ ContractRenewals
const char * dutyHelpKey(Duty duty)
Definition delegation.cpp:96
const char * delegationPresetKey(DelegationPreset preset)
Definition delegation.cpp:102