16 constexpr std::uint32_t
TextColour = 0x00C8C8C8U;
25 [[
nodiscard]] std::expected<std::vector<PlannedRow>, std::string>
29 const PlayerPlaybackInputs&
inputs,
33 std::vector<PlannedRow> rows;
34 if (
state.activeSort == 1)
return rows;
35 if (
state.activeSort != 0 &&
36 state.activeSort != 2 &&
37 state.activeSort != 3)
38 return std::unexpected(
39 "UDStats Deed value-text sort is outside retail 0..3 range");
42 if (!
grid)
return std::unexpected(
grid.error());
49 static_cast<std::size_t
>(
state.deedOrder[
rank]);
51 return std::unexpected(
52 "UDStats Deed value-text order references invalid square");
57 rows.reserve(
grid->size());
58 for (
const auto& deed : *
grid)
60 if (deed.square < 0 ||
62 return std::unexpected(
63 "UDStats Deed value-text grid references invalid square");
65 static_cast<std::size_t
>(deed.square);
67 return std::unexpected(
68 "UDStats Deed value-text metric is unavailable");
83 data::LegacyBitmapRGBA8
image{
91 struct RestoreFont
final
94 std::optional<fonts::Settings>
caller;
100 if (
font.settings().fontPath !=
caller->fontPath ||
font.settings().familyName !=
caller->familyName)
119 std::vector<PlannedRow> rows;
123 const auto resources =
playback.resources();
125 return std::unexpected(
126 "UDStats Deed value-text resources are unavailable");
129 resources->context().board);
136 std::optional{
fontRuntime->settings()} : std::nullopt;
142 const auto* savedSettings=
fontRuntime->savedSettings(0);
143 if(!savedSettings)
return std::unexpected(
"font setting slot is unavailable");
164 published_.size() + rows.size();
168 return std::unexpected(
169 "sequence command queue cannot fit UDStats Deed value-text transition");
178 return std::unexpected(
"sequence command queue cannot fit deed value redraws");
185 for (
const auto&
object : published_)
190 return std::unexpected(
191 "validated UDStats Deed value-text stop rejected");
199 return std::unexpected(
200 "UDStats Deed value-text font runtime is unavailable");
202 std::vector<data::LegacyBitmapRGBA8>
images;
203 images.reserve(rows.size());
208 return std::unexpected(
restored.error().detail);
210 return std::unexpected(
sized.error().detail);
213 for (
const auto&
row : rows)
218 return std::unexpected(
metrics.error().detail);
224 if (!
copied)
return std::unexpected(
copied.error().detail);
232 if (!
native)
return std::unexpected(
native.error().detail);
233 if (!
raster)
return std::unexpected(
raster.error().detail);
241 while (surfaces_.size() < rows.size())
242 surfaces_.push_back(std::nullopt);
247 if (!surfaces_[
index])
260 const auto updated =
playback.runtimeBitmaps().update(
262 if (!updated)
return updated;
275 content_.resize(rows.size());
282 for (
const auto&
object : published_)
287 return std::unexpected(
288 "validated UDStats Deed value-text stop rejected");
291 std::vector<Published>
next;
292 next.reserve(rows.size());
298 return std::unexpected(program.error().detail);
301 *program, DeedValueTextPriority, {},
304 return std::unexpected(
305 "validated UDStats Deed value-text start rejected");
310 published_ = std::move(
next);
311 content_.resize(rows.size());
323 fontSettings_.reset(); modernAA_ =
false;
std::optional< fonts::Settings > caller
static constexpr std::size_t Capacity
static std::expected< std::shared_ptr< const SequenceProgram >, RuntimeError > rawBitmap(data::DataId id, data::LegacyDataType sourceType, DescriptionLimits limits={})
std::expected< void, std::string > sync(const State &state, const rules::GameState &gameState, const PlayerPlaybackInputs &inputs, int monetarySystem, display::Screen2D desiredView, fonts::Runtime *fontRuntime, engine::SequencePlayback &playback, bool modernAA=false)
std::expected< void, std::string > blitStraightRGBA8(LegacyBitmapRGBA8 &destination, const LegacyBitmapRGBA8 &source, std::int32_t destinationX, std::int32_t destinationY, BitmapBlitMode mode)
std::expected< std::string, std::string > format(std::int64_t defaultValue, int monetarySystem, bool printSymbol, data::BoardEdition edition)
constexpr std::size_t SquareCount
SequenceTransform moveXYTransform(std::int32_t x, std::int32_t y) noexcept
constexpr int DeedOwnerBarOffsetX
constexpr std::uint32_t DeedValueTextWidth
constexpr int DeedOwnerBarOffsetY
std::expected< std::vector< DeedPlayback::Published >, std::string > planDeedGrid(const State &state, const rules::GameState &gameState, const PlayerPlaybackInputs &inputs)
constexpr std::uint16_t DeedValueTextPriority
constexpr std::uint32_t DeedValueTextHeight