Player12
An open source football management simulator
Loading...
Searching...
No Matches
transfer_windows.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 <cstdint>
13#include <optional>
14#include <span>
15
16#include "global/types.h"
17#include "model/gamedate.h"
18
30{
33{
34 std::uint8_t month = 1;
35 std::uint8_t day = 1;
36};
37
44
46inline constexpr std::int16_t FREE_AGENTS_ANY_TIME = -1;
47
50{
51 std::array<LeagueID, 2> leagues{};
57};
58
60std::span<const CountryRules> countries();
61
63const CountryRules& rulesFor(LeagueID league);
64
66bool isOpen(LeagueID league, const GameDateValue& date);
67
69bool isOpenAnywhere(const GameDateValue& date);
70
72bool isStartOfYearWindow(LeagueID league, const GameDateValue& date);
73
76std::optional<GameDateValue> windowEnd(LeagueID league,
77 const GameDateValue& date);
78
80bool isDeadlineDay(LeagueID league, const GameDateValue& date);
81
84
86bool canSignFreeAgent(LeagueID league, const GameDateValue& date);
87} // namespace TransferWindows
Definition transfer_windows.h:30
const CountryRules & rulesFor(LeagueID league)
Definition transfer_windows.cpp:126
std::span< const CountryRules > countries()
Definition transfer_windows.cpp:124
bool isOpen(LeagueID league, const GameDateValue &date)
Definition transfer_windows.cpp:134
bool isStartOfYearWindow(LeagueID league, const GameDateValue &date)
Definition transfer_windows.cpp:152
bool canSignFreeAgent(LeagueID league, const GameDateValue &date)
Definition transfer_windows.cpp:188
std::optional< GameDateValue > windowEnd(LeagueID league, const GameDateValue &date)
Definition transfer_windows.cpp:158
GameDateValue nextOpening(LeagueID league, const GameDateValue &date)
Definition transfer_windows.cpp:173
bool isDeadlineDay(LeagueID league, const GameDateValue &date)
Definition transfer_windows.cpp:167
constexpr std::int16_t FREE_AGENTS_ANY_TIME
Definition transfer_windows.h:46
bool isOpenAnywhere(const GameDateValue &date)
Definition transfer_windows.cpp:140
Represents a specific date in the game world.
Definition gamedate.h:20
Definition transfer_windows.h:50
Period start_of_year
Definition transfer_windows.h:53
std::array< LeagueID, 2 > leagues
Definition transfer_windows.h:51
std::int16_t free_agent_days
Definition transfer_windows.h:56
Period mid_year
Definition transfer_windows.h:52
Definition transfer_windows.h:33
std::uint8_t month
Definition transfer_windows.h:34
std::uint8_t day
Definition transfer_windows.h:35
Definition transfer_windows.h:40
MonthDay opens
Definition transfer_windows.h:41
MonthDay closes
Definition transfer_windows.h:42
uint8_t LeagueID
Type alias for League identifiers.
Definition types.h:15