Player12
An open source football management simulator
Loading...
Searching...
No Matches
next_action.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 <cstddef>
12#include <cstdint>
13#include <limits>
14#include <string>
15#include <vector>
16
17#include "global/types.h"
19
20class GameController;
21
35
37enum class ActionTarget : std::uint8_t
38{
39 Lineup,
40 Inbox,
44 Club,
45 Player,
47};
48
61
64{
65 struct Offer
66 {
67 std::uint32_t id = 0;
69 std::string player_name;
70 std::string buyer;
71 std::string fee;
72 bool loan = false;
73 int days_left = 0;
74 };
75 struct Person
76 {
78 std::string name;
79 };
80 struct Report
81 {
83 std::string name;
84 std::string scout;
85 };
86
88 int days_to_match = -1;
89 std::string next_opponent;
90 std::vector<std::string> unavailable_selected;
92 bool no_fit_replacements = false;
94 std::vector<Offer> offers;
95 std::vector<Person> pending_talks;
97 std::vector<Person> expiring_contracts;
99 bool pre_contract_period = false;
100 std::vector<Report> unseen_grade_a;
104 float average_condition = 100.0f;
106 float board_confidence = 60.0f;
107 bool window_open = false;
110 std::vector<std::string> squad_holes;
112 bool opposition_viewed = false;
113};
114
116{
117inline constexpr int TIRED_CONDITION = 75;
118inline constexpr int CONGESTED_TIRED_PLAYERS = 4;
119inline constexpr float CONGESTED_AVERAGE = 82.0f;
120inline constexpr float BOARD_WARNING_CONFIDENCE = 35.0f;
121inline constexpr int WINDOW_WARNING_DAYS = 14;
122inline constexpr int OPPOSITION_DAYS = 2;
124inline constexpr std::size_t MAX_OFFER_ACTIONS = 2;
125} // namespace NextActionRules
126
128std::vector<NextAction> rankNextActions(
129 const NextActionFacts& facts,
130 std::size_t limit = std::numeric_limits<std::size_t>::max());
131
Manages the core game logic, interacting with teams, leagues, and players.
Definition game_controller.h:70
Definition next_action.h:116
constexpr int OPPOSITION_DAYS
Definition next_action.h:122
constexpr float CONGESTED_AVERAGE
Definition next_action.h:119
constexpr std::size_t MAX_OFFER_ACTIONS
Definition next_action.h:124
constexpr int CONGESTED_TIRED_PLAYERS
Definition next_action.h:118
constexpr int TIRED_CONDITION
Definition next_action.h:117
constexpr int WINDOW_WARNING_DAYS
Definition next_action.h:121
constexpr float BOARD_WARNING_CONFIDENCE
Definition next_action.h:120
NextActionKind
Kinds of pending work the next-best-action engine knows.
Definition next_action.h:24
NextActionFacts gatherNextActionFacts(const GameController &controller)
Definition next_action.cpp:182
std::vector< NextAction > rankNextActions(const NextActionFacts &facts, std::size_t limit=std::numeric_limits< std::size_t >::max())
Definition next_action.cpp:60
ActionTarget
Where an action is taken care of.
Definition next_action.h:38
A localised line: key plus arguments ({0}, {1}...).
Definition match_analysis.h:116
Definition next_action.h:66
std::string fee
Definition next_action.h:71
bool loan
Definition next_action.h:72
std::string buyer
Definition next_action.h:70
PlayerID player
Definition next_action.h:68
int days_left
Definition next_action.h:73
std::string player_name
Definition next_action.h:69
Definition next_action.h:76
std::string name
Definition next_action.h:78
PlayerID player
Definition next_action.h:77
Definition next_action.h:81
PlayerID player
Definition next_action.h:82
std::string scout
Definition next_action.h:84
std::string name
Definition next_action.h:83
The facts the ranking is based on (gathered once per refresh).
Definition next_action.h:64
std::vector< std::string > unavailable_selected
Definition next_action.h:90
float board_confidence
Definition next_action.h:106
int days_to_match
Definition next_action.h:88
float average_condition
Definition next_action.h:104
std::vector< Report > unseen_grade_a
Definition next_action.h:100
bool no_fit_replacements
Definition next_action.h:92
bool window_open
Definition next_action.h:107
bool pre_contract_period
Definition next_action.h:99
int tired_players
Definition next_action.h:103
std::vector< std::string > squad_holes
Definition next_action.h:110
std::vector< Offer > offers
Definition next_action.h:94
int window_days_left
Definition next_action.h:108
std::string next_opponent
Definition next_action.h:89
std::vector< Person > pending_talks
Definition next_action.h:95
bool assistant_fixes_lineup
Definition next_action.h:93
int matches_next_week
Definition next_action.h:102
std::vector< Person > expiring_contracts
Definition next_action.h:97
bool assistant_runs_training
Definition next_action.h:105
bool opposition_viewed
Definition next_action.h:112
One ranked piece of pending work with the reason it matters.
Definition next_action.h:51
AnalysisLine title
Definition next_action.h:58
int priority
Definition next_action.h:57
NextActionKind kind
Definition next_action.h:52
AnalysisLine reason
Definition next_action.h:59
ActionTarget target
Definition next_action.h:53
std::uint32_t ref
Definition next_action.h:55
The pre-match opposition report.
Definition opposition_report.h:118
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21