Player12
An open source football management simulator
Loading...
Searching...
No Matches
match_tactics_panel.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 <vector>
12
13#include "global/types.h"
15#include "model/strategy.h"
16
27{
28 public:
30 static constexpr const char* WINDOW_ID = "###match_tactics_modal";
31
33 void reset(const Strategy& plan);
34
39 bool render(const TouchlineContext& context);
40
42 void resetPopup() { popup_opened = false; }
43
45 void requestClose() { close_requested = true; }
46
48 void syncDraft(const TouchlineContext& context);
49
51 [[nodiscard]] bool hasChanges(const TouchlineContext& context) const;
52
54 bool apply(const TouchlineContext& context);
55
57 bool undo(const TouchlineContext& context);
58
59 [[nodiscard]] bool canUndo() const { return !history.empty(); }
60 [[nodiscard]] const Strategy& getApplied() const { return applied; }
61
64 std::vector<Vector2F> draft_shape;
65
66 private:
67 struct Snapshot
68 {
70 std::vector<Vector2F> shape;
71 };
72
73 void renderStyle();
74 void renderInstructions();
75 void renderFormation(const TouchlineContext& context);
76 void renderFamiliarity(const TouchlineContext& context);
77 void renderFooter(const TouchlineContext& context);
78
80 std::vector<Snapshot> history;
81 bool popup_opened = false;
82 bool close_requested = false;
83};
Tactics dialog of the live match: style presets, the five instructions and the formation,...
Definition match_tactics_panel.h:27
bool close_requested
Definition match_tactics_panel.h:82
void renderInstructions()
Definition match_tactics_panel.cpp:200
void resetPopup()
Next render() opens the popup again, with a fresh draft.
Definition match_tactics_panel.h:42
bool canUndo() const
Definition match_tactics_panel.h:59
std::vector< Vector2F > draft_shape
Definition match_tactics_panel.h:64
void renderFormation(const TouchlineContext &context)
Definition match_tactics_panel.cpp:231
void syncDraft(const TouchlineContext &context)
Draft starts again from the tactics in force.
Definition match_tactics_panel.cpp:82
bool undo(const TouchlineContext &context)
Restores the tactics in force before the last apply.
Definition match_tactics_panel.cpp:119
void reset(const Strategy &plan)
Starts a match from the club's tactics (clears the history).
Definition match_tactics_panel.cpp:74
std::vector< Snapshot > history
Definition match_tactics_panel.h:80
void renderStyle()
Definition match_tactics_panel.cpp:174
const Strategy & getApplied() const
Definition match_tactics_panel.h:60
bool render(const TouchlineContext &context)
Draws the dialog while it is shown.
Definition match_tactics_panel.cpp:139
StrategySliders draft_sliders
Definition match_tactics_panel.h:63
bool popup_opened
Definition match_tactics_panel.h:81
bool apply(const TouchlineContext &context)
Sends the draft to the engine; false when nothing changed.
Definition match_tactics_panel.cpp:95
static constexpr const char * WINDOW_ID
Definition match_tactics_panel.h:30
bool hasChanges(const TouchlineContext &context) const
Whether the draft differs from the tactics in force.
Definition match_tactics_panel.cpp:88
void renderFamiliarity(const TouchlineContext &context)
Definition match_tactics_panel.cpp:311
Strategy applied
Definition match_tactics_panel.h:79
void requestClose()
Closes the dialog on its next frame.
Definition match_tactics_panel.h:45
void renderFooter(const TouchlineContext &context)
Definition match_tactics_panel.cpp:343
Represents the tactical setup of a team for a match.
Definition strategy.h:61
Definition match_tactics_panel.h:68
Strategy strategy
Definition match_tactics_panel.h:69
std::vector< Vector2F > shape
Definition match_tactics_panel.h:70
Team-wide tactical preferences in [0, 1].
Definition strategy.h:27
What the matchday dialogs act on: the live engine and the managed side, plus the match HUD's status l...
Definition match_touchline.h:27