Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
AuctionUI.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
8#include <array>
9#include <cstddef>
10#include <cstdint>
11#include <optional>
12
13namespace monopoly::auctionui
14{
15 inline constexpr std::size_t BillCount = 7;
16 inline constexpr std::array<std::int64_t, BillCount> BillDenominations{{
17 500, 100, 50, 20, 10, 5, 1
18 }};
19
20 inline constexpr int BackdropSmallWidth = 134;
21 inline constexpr int BackdropBigWidth = 200;
22 inline constexpr int BillTrayWidth = 131;
23 inline constexpr int BillWidth = 18;
24 inline constexpr int BillHeight = 31;
25 inline constexpr int BackdropHeight = 90;
26 inline constexpr int BillTraysHeight = 37;
27 inline constexpr int BackdropY = 600 - BackdropHeight;
28 inline constexpr int BillTraysY = BackdropY - BillTraysHeight;
29
30 enum class PennyBagsState : std::uint8_t
31 {
32 None = 0,
33 Idle,
34 Intro,
37 Begin,
41 Sold,
44 };
45
46 struct State
47 {
48 std::int64_t highestBid{};
49 std::uint32_t playersAllowedInAuction{};
50 std::array<std::int64_t, rules::MaxPlayers> bids{};
51 std::optional<rules::PlayerNumber> highestBidder;
52 std::uint32_t playersAllowedToBid{};
54 std::array<int, rules::MaxPlayers> backdropCenterX{};
60 std::uint32_t rollCallPlayers{};
61 std::int64_t rollCallSerial{};
62 };
63
65 {
66 std::optional<display::Screen2D> requestedBackdrop;
68 };
69
71 {
73 std::int64_t amount{};
74 std::uint8_t billIndex{};
75 };
76
77 void reset(State& state) noexcept;
78
79 [[nodiscard]] RuleUpdate processRuleMessage(
80 State& state,
82 const actions::Message& message,
84
86 const State& state,
87 rules::PlayerNumber numberOfPlayers,
89 rules::PlayerNumber player) noexcept;
90
91 [[nodiscard]] std::optional<BidRequest> planBid(
92 const State& state,
93 rules::PlayerNumber numberOfPlayers,
95 const uimsg::Message& message,
96 std::uint32_t localHumanMask) noexcept;
97}
unsigned state
unsigned index
constexpr int BillTrayWidth
Definition AuctionUI.hpp:22
constexpr std::size_t BillCount
Definition AuctionUI.hpp:15
constexpr int BillTraysHeight
Definition AuctionUI.hpp:26
constexpr int BackdropBigWidth
Definition AuctionUI.hpp:21
constexpr int BackdropSmallWidth
Definition AuctionUI.hpp:20
constexpr int BillHeight
Definition AuctionUI.hpp:24
constexpr int BackdropY
Definition AuctionUI.hpp:27
constexpr int BillTraysY
Definition AuctionUI.hpp:28
bool playerPanelWanted(const State &state, rules::PlayerNumber numberOfPlayers, display::Screen2D desiredView, rules::PlayerNumber player) noexcept
constexpr int BillWidth
Definition AuctionUI.hpp:23
std::optional< BidRequest > planBid(const State &state, rules::PlayerNumber numberOfPlayers, display::Screen2D desiredView, const uimsg::Message &message, std::uint32_t localHumanMask) noexcept
void reset(State &state) noexcept
Definition AuctionUI.cpp:44
RuleUpdate processRuleMessage(State &state, const rules::GameState &gameState, const actions::Message &message, display::Screen2D desiredView) noexcept
Definition AuctionUI.cpp:49
constexpr std::array< std::int64_t, BillCount > BillDenominations
Definition AuctionUI.hpp:16
constexpr int BackdropHeight
Definition AuctionUI.hpp:25
std::uint8_t PlayerNumber
Definition RuleTypes.hpp:12
constexpr PlayerNumber NobodyPlayer
Definition RuleTypes.hpp:16
rules::PlayerNumber player
Definition AuctionUI.hpp:72
std::optional< display::Screen2D > requestedBackdrop
Definition AuctionUI.hpp:66
std::array< std::int64_t, rules::MaxPlayers > bids
Definition AuctionUI.hpp:50
display::Screen2D formerView
Definition AuctionUI.hpp:56
std::uint32_t rollCallPlayers
Definition AuctionUI.hpp:60
std::optional< rules::PlayerNumber > highestBidder
Definition AuctionUI.hpp:51
std::uint32_t playersAllowedInAuction
Definition AuctionUI.hpp:49
std::uint32_t playersAllowedToBid
Definition AuctionUI.hpp:52
PennyBagsState nextPennyBags
Definition AuctionUI.hpp:57
std::array< int, rules::MaxPlayers > backdropCenterX
Definition AuctionUI.hpp:54