Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
IBar.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IBarLayout.hpp"
4#include "IBarRuleState.hpp"
5#include "RuleTypes.hpp"
6#include "UIMessages.hpp"
7
8#include <array>
9#include <cstdint>
10#include <optional>
11
12namespace monopoly::ibar
13{
15 {
16 bool visible = false;
17
18 bool local = false;
19
20 bool localHuman = false;
21
22 bool localAI = false;
23
24
26 };
27
28
29 struct State
30 {
31 std::array<
35
36
38
40
49
58 std::optional<std::uint8_t> selectedDeed;
59 std::optional<std::uint8_t> pendingPressedButton;
60 std::optional<std::uint8_t> desiredCardIndex;
61 std::optional<std::uint8_t> desiredBuyAuctionSquare;
62 std::optional<std::int64_t> cashAnimationAmount;
63 std::uint64_t cashAnimationTick{};
64 std::uint64_t cashAnimationSerial{};
65 std::optional<std::int64_t> decompositionHousesToSell;
67
68 // UDIBar.cpp Escape confirmation state. These flags deliberately mirror
69 // the retail globals instead of collapsing New Game and Exit together.
74 std::uint64_t escapeMenuOpenedTick{};
75
76 bool initialized = false;
77 };
78
79
80 bool initialize();
81
82
83 void shutdown();
84
85
86 void tickActions(
87 std::uint64_t numberOfTicks
88 );
89
90
91 void show();
92
95
97 const uimsg::Message& message
98 );
99
100
102 const actions::Message& message,
103 RuleMode projectedMode,
104 std::uint64_t tick = 0
105 ) noexcept;
106
107
108 void clearPendingPressedButton(std::uint8_t buttonIndex) noexcept;
109
111
112 void inspectPlayer(rules::PlayerNumber player) noexcept;
113
114
116 RuleMode projectedMode,
117 rules::PlayerNumber projectedPlayer
118 ) noexcept;
119
120 [[nodiscard]] rules::PlayerNumber resolveRulePlayer(
121 rules::PlayerNumber projectedPlayer
122 ) noexcept;
123
124
126 layout::ActionButtonLayout layout,
127 layout::ActionButtonMask activeSlots,
128 RuleMode mode,
129 rules::PlayerNumber player,
130 bool remote
131 ) noexcept;
132
133
134 void setPropertyHitState(layout::PropertyMask visibleProperties) noexcept;
135 [[nodiscard]] bool activateProperty(int square);
136
137
138 State& state();
139
140
142}
unsigned index
std::uint32_t PropertyMask
unsigned int ActionButtonMask
bool activateProperty(int square)
Definition IBar.cpp:1276
bool initialize()
Definition IBar.cpp:745
void processRuleMessage(const actions::Message &message, RuleMode projectedMode, std::uint64_t tick) noexcept
Definition IBar.cpp:1074
void clearPendingPressedButton(std::uint8_t buttonIndex) noexcept
Definition IBar.cpp:1194
void shutdown()
Definition IBar.cpp:765
void inspectPlayer(rules::PlayerNumber player) noexcept
Definition IBar.cpp:1205
bool requestNewGameConfirmation() noexcept
Definition IBar.cpp:785
void processLibraryMessage(const uimsg::Message &message)
Definition IBar.cpp:960
void setRuleActionHitState(layout::ActionButtonLayout buttonLayout, layout::ActionButtonMask activeSlots, RuleMode mode, rules::PlayerNumber player, bool remote) noexcept
Definition IBar.cpp:1238
bool requestExitConfirmation() noexcept
Definition IBar.cpp:792
void show()
Definition IBar.cpp:800
void restoreRuleTracking() noexcept
Definition IBar.cpp:1200
void tickActions(std::uint64_t numberOfTicks)
Definition IBar.cpp:773
State & state()
Definition IBar.cpp:1285
RuleMode resolveRuleMode(RuleMode projectedMode, rules::PlayerNumber projectedPlayer) noexcept
Definition IBar.cpp:1215
rules::PlayerNumber resolveRulePlayer(rules::PlayerNumber projectedPlayer) noexcept
Definition IBar.cpp:1228
const State & stateReadOnly()
Definition IBar.cpp:1291
void setPropertyHitState(layout::PropertyMask visibleProperties) noexcept
Definition IBar.cpp:1261
std::uint8_t PlayerNumber
Definition RuleTypes.hpp:12
constexpr PlayerNumber MaxPlayers
Definition RuleTypes.hpp:14
constexpr PlayerNumber NobodyPlayer
Definition RuleTypes.hpp:16
int propertyCurrentMouseOver
Definition IBar.hpp:51
rules::PlayerNumber projectedRulePlayer
Definition IBar.hpp:54
RuleMode localRuleMode
Definition IBar.hpp:56
layout::ActionButtonMask activeActionButtonSlots
Definition IBar.hpp:45
layout::ActionButtonLayout actionButtonLayout
Definition IBar.hpp:43
RuleMode actionRuleMode
Definition IBar.hpp:46
std::uint64_t escapeMenuOpenedTick
Definition IBar.hpp:74
std::uint64_t cashAnimationTick
Definition IBar.hpp:63
std::optional< std::uint8_t > desiredBuyAuctionSquare
Definition IBar.hpp:61
std::optional< std::int64_t > decompositionHousesToSell
Definition IBar.hpp:65
std::optional< std::uint8_t > pendingPressedButton
Definition IBar.hpp:59
int actionButtonCurrentMouseOver
Definition IBar.hpp:42
rules::PlayerNumber actionPlayer
Definition IBar.hpp:47
bool buttonBarForceUpdate
Definition IBar.hpp:66
layout::PropertyMask visiblePropertySlots
Definition IBar.hpp:52
std::optional< std::uint8_t > selectedDeed
Definition IBar.hpp:58
std::optional< std::uint8_t > desiredCardIndex
Definition IBar.hpp:60
RuleMode projectedRuleMode
Definition IBar.hpp:53
std::array< PlayerDisplay, rules::MaxPlayers > players
Definition IBar.hpp:34
std::optional< std::int64_t > cashAnimationAmount
Definition IBar.hpp:62
int actionButtonLastMouseOver
Definition IBar.hpp:41
rules::PlayerNumber localRulePlayer
Definition IBar.hpp:57
bool userRequestedNewGame
Definition IBar.hpp:71
std::uint64_t cashAnimationSerial
Definition IBar.hpp:64