Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
StatsAccountRuntime.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Actions.hpp"
4#include "ResourceRuntime.hpp"
5#include "RuleTypes.hpp"
6
7#include <expected>
8#include <filesystem>
9#include <string>
10#include <vector>
11
12namespace monopoly::statsui
13{
15 {
17 std::uint32_t turn{};
18 std::u16string description;
19 bool operator==(const AccountHistoryRow&) const = default;
20 };
21
23 {
24 std::uint64_t dividendCount{};
25 std::uint64_t bankErrorCount{};
26 std::uint32_t turn{};
29 std::vector<AccountHistoryRow> history;
30 };
31
32 [[nodiscard]] std::expected<std::u16string, std::string> statsPropertyName(
33 const data::LanguageCatalog& catalog, data::BoardEdition edition,
34 int city, int square);
35
36 // Owns acchist.txt. Rows use explicit LE32 player/turn and 500 UTF-16LE
37 // units, reproducing the Windows wide ACHAR record without native structs.
39 {
40 public:
41 [[nodiscard]] std::expected<void, std::string> open(
42 std::filesystem::path historyPath);
43 [[nodiscard]] std::expected<void, std::string> resetGame();
44 // Call before applying the notification to the UI projection so the
45 // previous house count remains available, like UDIBar.cpp.
46 [[nodiscard]] std::expected<void, std::string> processRuleMessage(
47 const actions::Message& message, const rules::GameState& previous,
48 rules::PlayerNumber iBarPlayer, int city,
49 const data::ResourceSnapshot& resources);
52 void scroll(int lines) noexcept;
53 void setScrollLimit(int lines) noexcept;
54 [[nodiscard]] const AccountState& state() const noexcept { return state_; }
55 private:
56 std::filesystem::path path_;
57 AccountState state_;
58 };
59}
unsigned index
std::expected< void, std::string > processRuleMessage(const actions::Message &message, const rules::GameState &previous, rules::PlayerNumber iBarPlayer, int city, const data::ResourceSnapshot &resources)
std::expected< void, std::string > resetGame()
const AccountState & state() const noexcept
std::expected< void, std::string > open(std::filesystem::path historyPath)
std::uint8_t PlayerNumber
Definition RuleTypes.hpp:12
constexpr PlayerNumber NobodyPlayer
Definition RuleTypes.hpp:16
std::expected< std::u16string, std::string > statsPropertyName(const data::LanguageCatalog &catalog, data::BoardEdition edition, int city, int square)
bool operator==(const AccountHistoryRow &) const =default
std::vector< AccountHistoryRow > history