Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
RuleRejections.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "LegacyTextIds.hpp"
4#include "Messaging.hpp"
5#include "PhaseStack.hpp"
6
7#include <cstdint>
8
10{
11 // Source Rule.cpp ErrorWrongPhase/ErrorWrongPlayer: rejected action,
12 // targeted explanation, then one phase refresh for a non-bank sender.
13 inline void send(const GameState& state, const actions::Message& message,
14 std::int64_t error)
15 {
17 BankPlayer, AllPlayers, static_cast<std::int64_t>(message.action),
18 0, message.fromPlayer, 0);
19 if (message.fromPlayer == BankPlayer) return;
20
22 ? message.fromPlayer : AllPlayers;
23 const auto phase = state.numberOfPendingPhases > 0
24 ? static_cast<std::int64_t>(phases::current(state).phase) : 0;
27 static_cast<std::int64_t>(message.action), message.fromPlayer, phase);
29 }
30
31 inline void wrongPhase(const GameState& state, const actions::Message& message)
33
34 inline void wrongPlayer(const GameState& state, const actions::Message& message)
36}
unsigned index
std::string error
constexpr std::int64_t ErrorWrongPlayer
constexpr std::int64_t ErrorWrongPhase
bool sendAction(const actions::Message &message)
const PendingPhase & current(const GameState &state)
void send(const GameState &state, const actions::Message &message, std::int64_t error)
void wrongPlayer(const GameState &state, const actions::Message &message)
void wrongPhase(const GameState &state, const actions::Message &message)
constexpr PlayerNumber BankPlayer
Definition RuleTypes.hpp:15
std::uint8_t PlayerNumber
Definition RuleTypes.hpp:12
const GameState & state()
constexpr PlayerNumber MaxPlayers
Definition RuleTypes.hpp:14
constexpr PlayerNumber AllPlayers
Definition RuleTypes.hpp:17
rules::PlayerNumber fromPlayer
Definition Actions.hpp:128
std::uint8_t numberOfPendingPhases