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
11
namespace
monopoly::dice
12
{
13
struct
RollRequest
14
{
15
std::array<std::uint8_t, 2>
values
{};
16
rules::PlayerNumber
player
{
rules::NobodyPlayer
};
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.
23
struct
PromptState
24
{
25
bool
ruleStartTurn
{};
26
bool
currentStartTurn
{};
27
bool
trackRules
{
true
};
28
bool
diceRollNotification
{};
29
void
process
(
const
actions::Message
& message)
noexcept
;
30
void
show
()
noexcept
{
if
(
trackRules
)
currentStartTurn
=
ruleStartTurn
; }
31
};
32
33
enum class
IngressError
: std::uint8_t
34
{
35
UnsupportedNotification
,
36
Busy
37
};
38
39
class
Ingress
final
40
{
41
public
:
42
[[
nodiscard
]] std::expected<RollRequest, IngressError>
process
(
43
rules::GameState
&
state
,
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
}
Actions.hpp
state
unsigned state
Definition
ModernIBarSkin.cpp:25
index
unsigned index
Definition
ModernIBarSkin.cpp:25
process
SDL_Process * process
Definition
OptionsHelpRuntime.cpp:93
RuleTypes.hpp
monopoly::dice::Ingress
Definition
DiceIngress.hpp:40
monopoly::dice::Ingress::pending
bool pending() const noexcept
Definition
DiceIngress.hpp:48
monopoly::dice::Ingress::reset
void reset() noexcept
Definition
DiceIngress.hpp:49
monopoly::dice::Ingress::take
std::optional< RollRequest > take() noexcept
Definition
DiceIngress.cpp:51
monopoly::dice
Definition
DiceDisplay.cpp:6
monopoly::dice::IngressError
IngressError
Definition
DiceIngress.hpp:34
monopoly::dice::IngressError::UnsupportedNotification
@ UnsupportedNotification
monopoly::dice::IngressError::Busy
@ Busy
monopoly::rules::PlayerNumber
std::uint8_t PlayerNumber
Definition
RuleTypes.hpp:12
monopoly::rules::NobodyPlayer
constexpr PlayerNumber NobodyPlayer
Definition
RuleTypes.hpp:16
monopoly::actions::Message
Definition
Actions.hpp:125
monopoly::dice::PromptState
Definition
DiceIngress.hpp:24
monopoly::dice::PromptState::currentStartTurn
bool currentStartTurn
Definition
DiceIngress.hpp:26
monopoly::dice::PromptState::ruleStartTurn
bool ruleStartTurn
Definition
DiceIngress.hpp:25
monopoly::dice::PromptState::diceRollNotification
bool diceRollNotification
Definition
DiceIngress.hpp:28
monopoly::dice::PromptState::trackRules
bool trackRules
Definition
DiceIngress.hpp:27
monopoly::dice::PromptState::show
void show() noexcept
Definition
DiceIngress.hpp:30
monopoly::dice::RollRequest
Definition
DiceIngress.hpp:14
monopoly::dice::RollRequest::lockTick
std::uint64_t lockTick
Definition
DiceIngress.hpp:17
monopoly::dice::RollRequest::values
std::array< std::uint8_t, 2 > values
Definition
DiceIngress.hpp:15
monopoly::dice::RollRequest::player
rules::PlayerNumber player
Definition
DiceIngress.hpp:16
monopoly::rules::GameState
Definition
RuleTypes.hpp:259
DiceIngress.hpp
Generated by
1.9.8