Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
PieceIdlePlayback.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "PieceRuntime.hpp"
6
7#include <expected>
8#include <optional>
9#include <string>
10
11namespace monopoly::pieces
12{
14 {
15 bool active{};
16 bool completed{};
17 };
18
20 {
21 public:
22 [[nodiscard]] std::expected<void, std::string> begin(
24 [[nodiscard]] std::expected<PieceIdlePlaybackUpdate, std::string> tick(
26
27 [[nodiscard]] bool active() const noexcept { return plan_.has_value(); }
29 { return movingOutSequence_; }
31 { return movingInSequence_; }
32 [[nodiscard]] std::optional<rules::PlayerNumber> movingOutPlayer() const noexcept
33 { return plan_ && plan_->movingOut ? std::optional<rules::PlayerNumber>(plan_->movingOut->player) : std::nullopt; }
34 [[nodiscard]] std::optional<rules::PlayerNumber> movingInPlayer() const noexcept
35 { return plan_ && plan_->movingIn ? std::optional<rules::PlayerNumber>(plan_->movingIn->player) : std::nullopt; }
36
37 private:
38 [[nodiscard]] std::expected<void, std::string> startAnimation(
42 engine::SequencePlayback& playback) const noexcept;
43
44 std::optional<PieceIdleTransitionPlan> plan_;
45 data::DataId movingOutSequence_{data::EmptyDataId};
46 data::DataId movingInSequence_{data::EmptyDataId};
47 bool started_{};
48 };
49}
decision::EconomicActionPlan plan
unsigned index
std::atomic< bool > finished
data::DataId movingOutSequence() const noexcept
data::DataId movingInSequence() const noexcept
std::optional< rules::PlayerNumber > movingOutPlayer() const noexcept
std::expected< void, std::string > begin(PieceIdleTransitionPlan plan)
std::optional< rules::PlayerNumber > movingInPlayer() const noexcept
std::expected< PieceIdlePlaybackUpdate, std::string > tick(engine::SequencePlayback &playback)
std::uint32_t DataId
Definition DataBanks.hpp:10
constexpr DataId EmptyDataId
Definition DataBanks.hpp:13