26 if (!resources)
return std::unexpected(
"Trade panel text has no resources");
27 const auto language =
resources->language();
28 if (!language || !language->catalog)
29 return std::unexpected(
"Trade panel text has no language catalog");
31 if (!
text)
return std::unexpected(
text.error().detail);
45 data::LegacyBitmapRGBA8&
image,
47 const std::vector<std::string>&
lines,
54 if (!
first)
return std::unexpected(
first.error().detail);
57 for (
const auto& line :
lines)
77 data::LegacyBitmapRGBA8&
image, fonts::Runtime&
font,
78 std::string_view
text,
int size,
int weight,
int&
y)
81 if (!
sized)
return std::unexpected(
sized.error().detail);
82 font.setWeight(weight);
font.setUnderline(
false);
83 font.setItalic(
false);
font.setStrikeOut(
false);
85 if (!
lines)
return std::unexpected(
lines.error().detail);
93 for (
const auto& line : *
lines)
98 line, 0x00D3EBF5U, size * 3, weight,
false,
false,
false,
true);
99 if (!
raster)
return std::unexpected(
raster.error().detail);
103 const int x = (
static_cast<int>(
image.width) -
static_cast<int>(
raster->width)) / 2;
113 struct RestoreDefaultFont
final
143 if (!visible_)
return {};
145 *surface_, TradePanelTextPriority, false}))
146 return std::unexpected(
"validated Trade panel-text stop rejected");
151 return std::unexpected(
"Trade panel text font runtime is unavailable");
164 const auto resources =
playback.resources();
172 !contentKey_ || *contentKey_ !=
key || modernAA_ !=
modernAA ||
183 if (!title)
return std::unexpected(title.error());
186 : std::expected<bool, std::string>{
false};
187 if (!body)
return std::unexpected(body.error());
198 if (!
sized)
return std::unexpected(
sized.error().detail);
210 if (!
sized)
return std::unexpected(
sized.error().detail);
220 const auto updated =
playback.runtimeBitmaps().update(
222 if (!updated)
return std::unexpected(updated.error());
238 if (
playback.commands().pendingCount() >=
240 return std::unexpected(
241 "sequence command queue cannot fit Trade panel-text start");
244 if (!program)
return std::unexpected(program.error().detail);
246 *program, TradePanelTextPriority, {},
248 return std::unexpected(
"validated Trade panel-text start rejected");
258 modernAA_ =
false; fontSettings_.reset();
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, 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, Error > transcodeUtf8(std::u16string_view text)
constexpr PlayerNumber MaxPlayers
SequenceTransform moveXYTransform(std::int32_t x, std::int32_t y) noexcept
std::shared_ptr< const data::ResourceSnapshot > resources() noexcept
constexpr std::uint16_t TradePanelTextPriority