Player12
An open source football management simulator
Loading...
Searching...
No Matches
squad_planner_scene.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 <optional>
13#include <string>
14#include <vector>
15
17#include "model/squad_planner.h"
18#include "model/squad_status.h"
19
27{
28 public:
29 explicit SquadPlannerScene(GUIView* parent);
30
31 void update(float deltaTime) override;
32 [[nodiscard]] SceneID getID() const override
33 {
35 }
36
37 protected:
38 void renderContent() override;
39 [[nodiscard]] NavSection navSection() const override
40 {
42 }
43 void refresh() override;
44
45 private:
47
49 struct Row
50 {
51 PlayerID id = 0;
52 std::string name;
53 std::string role;
54 std::string age;
55 std::string overall;
56 std::string contract;
57 std::string status;
59 float overall_value = 0.0f;
60 int age_value = 0;
61 std::optional<SquadStatus> given;
63 bool expiring = false;
64 bool ageing = false;
65 bool injured = false;
66 };
67
69 struct Group
70 {
72 std::string header;
73 int missing = 0;
74 std::vector<Row> rows;
75 };
76
85
87 struct View
88 {
89 std::array<Group, PLANNER_GROUP_COUNT> groups;
90 std::vector<Need> needs;
91 std::array<int, AGE_BAND_COUNT> age_bands{};
92 std::array<std::string, AGE_BAND_COUNT> age_counts;
93 std::vector<std::pair<std::string, std::string>>
95 std::string departures;
96 std::string squad_size;
97 std::string average_age;
98 int expiring = 0;
99 };
100
101 void build(View& view, int season_offset) const;
102 void renderDepth(float width);
103 void renderGroup(const Group& group);
104 void renderDetail(const Row& row);
105 void renderNeeds(float width);
106 void renderProfile(float width);
107 void addFocus(const Need& need);
108
109 std::array<View, 2> views;
110 int season = 0;
112 bool stale = false;
113 std::uint16_t season_year = 0;
114};
Main view manager for the GUI. Handles scenes and overlays.
Definition gui_view.h:29
Base class for every in-career screen.
Definition management_scene.h:93
Squad planner: depth chart per position group (first choice, backup, prospect) with the manager's squ...
Definition squad_planner_scene.h:27
void renderGroup(const Group &group)
Definition squad_planner_scene.cpp:309
void update(float deltaTime) override
Updates scene logic.
Definition squad_planner_scene.cpp:94
void renderProfile(float width)
Definition squad_planner_scene.cpp:507
void renderNeeds(float width)
Definition squad_planner_scene.cpp:450
void refresh() override
Rebuilds cached view models from the game state.
Definition squad_planner_scene.cpp:100
void build(View &view, int season_offset) const
Definition squad_planner_scene.cpp:110
void renderContent() override
Draws the page body inside the content region.
Definition squad_planner_scene.cpp:239
SceneID getID() const override
Gets the ID of the scene.
Definition squad_planner_scene.h:32
NavSection navSection() const override
Sidebar entry highlighted for this screen.
Definition squad_planner_scene.h:39
bool stale
Definition squad_planner_scene.h:112
std::array< View, 2 > views
Definition squad_planner_scene.h:109
void renderDetail(const Row &row)
Definition squad_planner_scene.cpp:382
int season
Definition squad_planner_scene.h:110
void renderDepth(float width)
Definition squad_planner_scene.cpp:301
std::uint16_t season_year
Definition squad_planner_scene.h:113
PlayerID selected
Definition squad_planner_scene.h:111
friend class GameFlowTest_GUIFlowLifecycle_Test
Definition squad_planner_scene.h:46
void addFocus(const Need &need)
Definition squad_planner_scene.cpp:535
SceneID
Identifiers for different GUI scenes.
Definition gui_scene.h:24
@ SQUAD_PLANNER
NavSection
Screens of the management shell. The sidebar groups them into a few hubs (Home, Inbox,...
Definition nav_history.h:26
PlannerGroup
Position groups of the depth chart (the groups computer-managed clubs count when they look for missin...
Definition squad_planner.h:25
NeedKind
Why the planner suggests recruitment (or a sale) for a group.
Definition squad_planner.h:88
DepthTier
Place of a player in his group's depth chart.
Definition squad_planner.h:41
SquadStatus
Place in the squad the manager gives a player (values persisted).
Definition squad_status.h:31
One position group of the depth chart.
Definition squad_planner_scene.h:70
std::vector< Row > rows
Definition squad_planner_scene.h:74
int missing
Definition squad_planner_scene.h:73
PlannerGroup group
Definition squad_planner_scene.h:71
std::string header
Definition squad_planner_scene.h:72
A suggested need, pre-formatted.
Definition squad_planner_scene.h:79
NeedKind kind
Definition squad_planner_scene.h:80
PlannerGroup group
Definition squad_planner_scene.h:81
std::string text
Definition squad_planner_scene.h:82
float min_ability
Definition squad_planner_scene.h:83
One player in the depth chart, pre-formatted.
Definition squad_planner_scene.h:50
std::string role
Definition squad_planner_scene.h:53
std::string age
Definition squad_planner_scene.h:54
bool ageing
Definition squad_planner_scene.h:64
std::string name
Definition squad_planner_scene.h:52
DepthTier tier
Definition squad_planner_scene.h:58
bool injured
Definition squad_planner_scene.h:65
bool expiring
Definition squad_planner_scene.h:63
std::string overall
Definition squad_planner_scene.h:55
std::string contract
Definition squad_planner_scene.h:56
SquadStatus deserved
Definition squad_planner_scene.h:62
float overall_value
Definition squad_planner_scene.h:59
int age_value
Definition squad_planner_scene.h:60
std::string status
Definition squad_planner_scene.h:57
std::optional< SquadStatus > given
Definition squad_planner_scene.h:61
Everything shown for one season.
Definition squad_planner_scene.h:88
std::vector< std::pair< std::string, std::string > > expiries
Definition squad_planner_scene.h:94
std::array< std::string, AGE_BAND_COUNT > age_counts
Definition squad_planner_scene.h:92
std::array< Group, PLANNER_GROUP_COUNT > groups
Definition squad_planner_scene.h:89
std::vector< Need > needs
Definition squad_planner_scene.h:90
std::string squad_size
Definition squad_planner_scene.h:96
std::string departures
Definition squad_planner_scene.h:95
std::string average_age
Definition squad_planner_scene.h:97
std::array< int, AGE_BAND_COUNT > age_bands
Definition squad_planner_scene.h:91
int expiring
Definition squad_planner_scene.h:98
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21