Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
PieceMoveIngress.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Actions.hpp"
4#include "PieceMovePlan.hpp"
5#include "RuleTypes.hpp"
6
7#include <cstdint>
8#include <expected>
9#include <functional>
10#include <optional>
11
12namespace monopoly::pieces
13{
22
24 {
26 std::optional<PieceMovePlanError> planner;
27 };
28
44
46 {
47 public:
48 using RandomBitSource = std::function<std::uint8_t()>;
49
52
53 void reset() noexcept;
55 process(rules::GameState& uiState, const actions::Message& message,
56 bool animationsEnabled);
57
59 { return pendingPlan_.has_value(); }
61 { return pendingSpecial_.has_value(); }
62 [[nodiscard]] std::optional<PieceMovePlan> takePlan();
63 [[nodiscard]] std::optional<PieceMoveSpecialRequest> takeSpecial();
64
65 private:
66 [[nodiscard]] std::expected<PieceMovePlan, PieceMoveIngressError>
67 buildPlan(actions::Type action, std::uint8_t token,
68 std::int32_t before, std::int32_t after, bool animationsEnabled);
69
70 RandomBitSource randomBit_;
71 std::optional<PieceMovePlan> pendingPlan_;
72 std::optional<PieceMoveSpecialRequest> pendingSpecial_;
73 };
74}
unsigned index
int token
SDL_Process * process
std::optional< PieceMoveSpecialRequest > takeSpecial()
std::function< std::uint8_t()> RandomBitSource
std::optional< PieceMovePlan > takePlan()
std::uint8_t PlayerNumber
Definition RuleTypes.hpp:12
std::optional< PieceMovePlanError > planner