25 constexpr std::uint32_t
TextColour = 0x00FFFFFFU;
28 const data::LanguageCatalog& catalog, std::uint32_t
id)
31 if (!
text)
return std::unexpected(
text.error().detail);
38 const DeedPlayback::Published& item,
int x,
int y)
noexcept
44 [[
nodiscard]] std::expected<std::optional<int>, std::string>
47 const PlayerPlaybackInputs&
inputs)
50 return std::optional<int>{};
52 if (!
grid)
return std::unexpected(
grid.error());
53 for (
const auto& item : *
grid)
56 return std::optional<int>{};
70 (
static_cast<std::size_t
>(
y) *
image.width +
71 static_cast<std::size_t
>(
x)) * 4U;
73 static_cast<std::uint8_t
>(
colour);
75 static_cast<std::uint8_t
>(
colour >> 8U);
77 static_cast<std::uint8_t
>(
colour >> 16U);
83 data::LegacyBitmapRGBA8&
image, fonts::Runtime&
font,
84 std::string_view
text,
int x,
int y)
86 if (
text.empty())
return {};
95 if(!
glyphs)
return std::unexpected(
glyphs.error().detail);
107 data::LegacyBitmapRGBA8&
image, fonts::Runtime&
font,
117 fonts::Runtime&
font)
120 if (!size)
return std::unexpected(
size.error().detail);
126 fonts::Runtime&
font)
129 if (!size)
return std::unexpected(
size.error().detail);
135 data::LegacyBitmapRGBA8&
image, fonts::Runtime&
font,
136 std::string_view owner)
142 while (
metrics->width > 164 && size > 1)
147 return std::unexpected(
resized.error().detail);
151 return std::unexpected(
metrics.error().detail);
157 data::LegacyBitmapRGBA8&
image, fonts::Runtime&
font,
158 std::string_view
label)
167 if (!
lines)
return std::unexpected(
lines.error().detail);
170 return std::unexpected(
lineMetrics.error().detail);
172 for (std::size_t
i = 0;
175 if (
auto result =
print(
184 struct RestoreFont
final
193 if(
font.settings().fontPath!=
caller->fontPath ||
font.settings().familyName!=
caller->familyName)
211 std::optional<int> square;
216 if (!hovered)
return std::unexpected(hovered.error());
222 if (!visible_)
return {};
225 *surface_, DeedFloaterTextPriority, false}))
226 return std::unexpected(
227 "UDStats Deed floater text stop queue is full");
234 return std::unexpected(
235 "UDStats Deed floater text square is out of range");
237 return std::unexpected(
238 "UDStats Deed floater text font runtime is unavailable");
240 const auto resources =
playback.resources();
241 const auto language = resources ? resources->language() :
nullptr;
242 if (!language || !language->catalog)
243 return std::unexpected(
244 "UDStats Deed floater text has no language catalog");
246 playback.commands().pendingCount() >=
248 return std::unexpected(
249 "UDStats Deed floater text start queue is full");
251 const auto& catalog = *language->catalog;
262 gameState.squares[
static_cast<std::size_t
>(*square)];
267 if (!
bank)
return std::unexpected(
bank.error());
286 const auto edition = resources->context().board;
288 rent, monetarySystem,
false, edition);
290 squareState.gameEarnings, monetarySystem,
false, edition);
292 rent, monetarySystem,
false, edition);
304 return std::unexpected(
305 "sequence command queue cannot fit UDStats Deed floater text transition");
307 const std::string
key =
308 std::to_string(*square) +
':' +
310 std::to_string(monetarySystem) +
':' + owner +
':' +
316 const auto* savedSettings=
fontRuntime->savedSettings(0);
317 if(!savedSettings)
return std::unexpected(
"font setting slot is unavailable");
326 return std::unexpected(
"sequence command queue cannot fit deed text redraw");
332 return std::unexpected(
restored.error().detail);
334 const unsigned scale=
modernAA?3U:1U;
343 if (
auto result =
print(
355 if (
auto result =
print(
368 if (
auto result =
print(
397 const auto updated =
playback.runtimeBitmaps().update(
399 if (!updated)
return updated;
410 if (!visible_ || currentX_ !=
desiredX)
412 const std::size_t
needed = visible_ ? 2U : 1U;
416 return std::unexpected(
417 "sequence command queue cannot fit UDStats Deed floater text transition");
421 if (!program)
return std::unexpected(program.error().detail);
427 *surface_, DeedFloaterTextPriority, false}))
428 return std::unexpected(
429 "validated UDStats Deed floater text stop rejected");
433 *program, DeedFloaterTextPriority, {},
435 return std::unexpected(
436 "validated UDStats Deed floater text start rejected");
447 fontSettings_.reset();modernAA_=
false;
std::atomic< float > right
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 deedPopupVisible=false, bool modernAA=false)
std::int64_t rentIfSteppedOn(const rules::GameState &state, SquareType square, rules::board::PropertySet propertiesOwned) noexcept
rules::board::PropertySet propertiesOwnedByPlayer(const rules::GameState &state, rules::PlayerNumber player) noexcept
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, Error > transcodeUtf8(std::u16string_view text)
std::expected< std::string, std::string > format(std::int64_t defaultValue, int monetarySystem, bool printSymbol, data::BoardEdition edition)
std::vector< ObjectSpec > catalog(bool europe)
std::uint32_t PropertySet
constexpr std::size_t SquareCount
constexpr PlayerNumber MaxPlayers
SequenceTransform moveXYTransform(std::int32_t x, std::int32_t y) noexcept
constexpr std::uint16_t DeedFloaterTextPriority
constexpr int DeedCardHitHeight
constexpr int DeedCardHitWidth
std::expected< std::vector< DeedPlayback::Published >, std::string > planDeedGrid(const State &state, const rules::GameState &gameState, const PlayerPlaybackInputs &inputs)
std::vector< std::uint8_t > pixels