Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
PlayerSelection.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Actions.hpp"
4#include "Display.hpp"
5#include "RuleTypes.hpp"
6#include "UIMessages.hpp"
7#include "PlayerSetupFlow.hpp"
8
9#include <array>
10#include <cstdint>
11#include <string>
12#include <filesystem>
13#include <expected>
14#include <span>
15
17{
18 struct RenderState;
19 struct RuleHit;
21 {
22 std::wstring name;
23
24 std::uint8_t token = 0;
25 int aiLevel = 0;
26 int citySelected = 0;
27
28 bool customRulesDesired = false;
29 bool startButtonPressed = false;
30 };
31
33 {
34 bool occupied = false;
35
36 std::wstring name;
37
38 std::uint8_t token = 0;
39 std::uint8_t colour = 0;
40 std::uint8_t aiLevel = 0;
41 };
42
43 struct State
44 {
46
47 std::array<PlayerSlot, rules::MaxPlayers> players{};
48
49 std::uint8_t numberOfPlayers = 0;
50
51 bool forcedRefresh = false;
53 };
54
55 bool initialize();
56 void shutdown();
57
59 void update();
60
61 void show();
62
64 void visualPhaseStarted(ui::playersetup::Phase phase) noexcept;
65 void setPlaybackState(bool interactable, std::span<const RuleHit> rules,
67 [[nodiscard]] std::expected<void, std::string> configureHistory(std::filesystem::path path);
70 [[nodiscard]] std::expected<void, std::string> commitCustomBoard(
71 std::filesystem::path assetRoot);
72 void recordGameStarted();
73
74 void processMessage(const actions::Message& message);
75
77 const uimsg::Message& message
78 );
79
81 rules::PlayerNumber player
82 );
83
84
85 State& state();
87}
88
89
90
91
92
unsigned index
std::string path
void visualPhaseStarted(ui::playersetup::Phase phase) noexcept
void setPlaybackState(bool interactable, std::span< const RuleHit > hits, ui::playersetup::Rect restore, ui::playersetup::Rect shortGame)
bool consumeCustomBoardRequest() noexcept
std::expected< void, std::string > configureHistory(std::filesystem::path path)
void processLibraryMessage(const uimsg::Message &message)
std::expected< void, std::string > commitCustomBoard(std::filesystem::path assetRoot)
void playerButtonClicked(rules::PlayerNumber player)
void processMessage(const actions::Message &message)
void switchPhase(display::PlayerSetupPhase phase)
std::array< PlayerSlot, rules::MaxPlayers > players