Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
DiceIngress.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Actions.hpp"
4#include "RuleTypes.hpp"
5
6#include <array>
7#include <cstdint>
8#include <expected>
9#include <optional>
10
11namespace monopoly::dice
12{
14 {
15 std::array<std::uint8_t, 2> values{};
17 std::uint64_t lockTick{};
18 };
19
20 // The StartTurn predicate consumed by UDPieces, projected from the
21 // currently ported UDIBar turn notifications. The complete IBar modal
22 // state machine remains separate; a UI override can suspend rule tracking.
24 {
27 bool trackRules{true};
29 void process(const actions::Message& message) noexcept;
31 };
32
33 enum class IngressError : std::uint8_t
34 {
36 Busy
37 };
38
40 {
41 public:
42 [[nodiscard]] std::expected<RollRequest, IngressError> process(
44 const actions::Message& message,
45 std::uint64_t tick) noexcept;
46
47 [[nodiscard]] std::optional<RollRequest> take() noexcept;
48 [[nodiscard]] bool pending() const noexcept { return pending_.has_value(); }
49 void reset() noexcept { pending_.reset(); }
50
51 private:
52 std::optional<RollRequest> pending_;
53 };
54}
unsigned state
unsigned index
SDL_Process * process
bool pending() const noexcept
void reset() noexcept
std::optional< RollRequest > take() noexcept
std::uint8_t PlayerNumber
Definition RuleTypes.hpp:12
constexpr PlayerNumber NobodyPlayer
Definition RuleTypes.hpp:16
std::array< std::uint8_t, 2 > values
rules::PlayerNumber player