Player12
An open source football management simulator
Loading...
Searching...
No Matches
set_pieces_dialog.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 <string>
13#include <vector>
14
15#include "model/lineup.h"
16
17class GameController;
18
25{
26 public:
28 void open()
29 {
30 open_requested = true;
31 close_requested = false;
32 }
33
35 void close() { close_requested = true; }
36
41 bool render(GameController& controller);
42
44 static std::string captainSummary(const GameController& controller);
45
46 private:
48
49 struct Choice
50 {
51 PlayerID id = 0;
52 std::string label;
53 };
54
55 void rebuild(const GameController& controller);
56
57 bool open_requested = false;
58 bool close_requested = false;
59 std::array<std::vector<Choice>, SET_PIECE_DUTY_COUNT> choices;
60 std::array<std::string, SET_PIECE_DUTY_COUNT> automatic;
61 std::array<std::string, SET_PIECE_DUTY_COUNT> current;
62};
Manages the core game logic, interacting with teams, leagues, and players.
Definition game_controller.h:70
Captain, vice-captain and set-piece takers of the managed lineup: one dropdown per duty listing the s...
Definition set_pieces_dialog.h:25
bool render(GameController &controller)
Draws the dialog while it is open.
Definition set_pieces_dialog.cpp:123
std::array< std::string, SET_PIECE_DUTY_COUNT > current
Definition set_pieces_dialog.h:61
void rebuild(const GameController &controller)
Definition set_pieces_dialog.cpp:46
std::array< std::vector< Choice >, SET_PIECE_DUTY_COUNT > choices
Definition set_pieces_dialog.h:59
bool close_requested
Definition set_pieces_dialog.h:58
std::array< std::string, SET_PIECE_DUTY_COUNT > automatic
Definition set_pieces_dialog.h:60
bool open_requested
Definition set_pieces_dialog.h:57
void open()
Opens the dialog on the next render().
Definition set_pieces_dialog.h:28
void close()
Closes the dialog on the next render().
Definition set_pieces_dialog.h:35
friend class GameFlowTest_GUIFlowLifecycle_Test
Definition set_pieces_dialog.h:47
static std::string captainSummary(const GameController &controller)
One-line summary for the lineup toolbar ("Captain: Name").
Definition set_pieces_dialog.cpp:37
constexpr size_t SET_PIECE_DUTY_COUNT
Definition lineup.h:38
Definition set_pieces_dialog.h:50
std::string label
Definition set_pieces_dialog.h:52
uint32_t PlayerID
Type alias for Player identifiers.
Definition types.h:21