Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
EuropeanDeed.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "BitmapRuntime.hpp"
4#include "FontRuntime.hpp"
5
6#include <expected>
7#include <functional>
8#include <memory>
9#include <string>
10#include <vector>
11
12namespace monopoly::deeds
13{
14 inline constexpr int Width = 199;
15 inline constexpr int Height = 227;
16
17 struct Request
18 {
19 int square{};
20 int languageId{2}; // Source language IDs: UK=2 .. Norwegian=10.
21 int board{}; // Europe board 0..11; -1 uses installed language's board.
22 int monetarySystem{}; // Source currency IDs 0..13.
23 bool front{true};
25 bool usaPresentation{false}; // Explicit modern USA text plan; ordinary Europe path unchanged.
26 };
27
28 struct Fill
29 {
30 int x{}, y{}, width{}, height{};
31 std::uint32_t color{};
32 };
33
35 {
36 std::string text;
38 std::uint32_t color{};
40 };
41
42 struct Plan
43 {
45 std::vector<Fill> fills;
46 std::vector<TextRegion> text;
47 };
48
49 // Unlike IBar's board-order property index, this preserves TRANS_PROP's
50 // streets-first, railroads-then-utilities ordering.
51 [[nodiscard]] int propertyIndex(int square) noexcept;
52 [[nodiscard]] data::DataId templateId(const Request& request) noexcept;
53
54 // Printed deed rents are canonical: source short-game table swaps are
55 // compensated by CreateDeed. Planning does not depend on mutable rule state.
56 [[nodiscard]] std::expected<Plan, std::string> plan(const Request& request);
57
58 using TemplateResolver = std::function<std::expected<
59 std::shared_ptr<const data::BitmapRuntimeAsset>, std::string>(data::DataId)>;
60
61 // Uses the caller's retail Arial font and preserves all its settings.
62 // Missing templates/font/render failures are errors, never blank deeds.
63 [[nodiscard]] std::expected<data::LegacyBitmapRGBA8, std::string> render(
64 const Request& request, fonts::Runtime& fonts,
66}
decision::EconomicActionPlan plan
unsigned index
std::uint32_t DataId
Definition DataBanks.hpp:10
std::expected< data::LegacyBitmapRGBA8, std::string > render(const Request &request, fonts::Runtime &fonts, const TemplateResolver &resolveTemplate)
constexpr int Height
data::DataId templateId(const Request &request) noexcept
std::function< std::expected< std::shared_ptr< const data::BitmapRuntimeAsset >, std::string >(data::DataId)> TemplateResolver
int propertyIndex(int square) noexcept
constexpr int Width
std::vector< TextRegion > text
std::vector< Fill > fills