Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
PlayerSelectionHistory.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <expected>
5#include <filesystem>
6#include <span>
7#include <string>
8#include <vector>
9
11{
13 {
14 std::wstring name;
15 int wins{};
17 };
19 {
20 std::wstring name;
21 int aiLevel{};
22 bool local{};
23 };
25 {
26 public:
27 [[nodiscard]] std::expected<void,std::string> open(std::filesystem::path path);
28 [[nodiscard]] std::expected<void,std::string> gameStarted(std::span<const HistoryPlayer> players);
29 [[nodiscard]] std::expected<void,std::string> gameOver(std::wstring_view name,int worth,int aiLevel);
30 [[nodiscard]] std::vector<HistoryEntry> highScores() const;
31 [[nodiscard]] std::vector<std::wstring> names() const;
32 [[nodiscard]] const std::array<HistoryEntry,100>& entries() const noexcept {return entries_;}
33 [[nodiscard]] bool configured() const noexcept {return !path_.empty();}
34 private:
35 [[nodiscard]] std::expected<void,std::string> save(const std::array<HistoryEntry,100>& entries);
36 std::filesystem::path path_;
37 std::array<HistoryEntry,100> entries_{};
38 std::string preserved_;
39 bool winnerProcessed_{};
40 };
41}
std::array< rules::PlayerNumber, rules::MaxPlayers > players
const char * name
unsigned index
std::string path
const std::array< HistoryEntry, 100 > & entries() const noexcept
std::expected< void, std::string > gameStarted(std::span< const HistoryPlayer > players)
std::expected< void, std::string > gameOver(std::wstring_view name, int worth, int aiLevel)
std::expected< void, std::string > open(std::filesystem::path path)