20 1, 3, 6, 8, 9, 11, 13, 14, 16, 18, 19, 21, 23, 24,
21 26, 27, 29, 31, 32, 34, 37, 39, 5, 15, 25, 35, 12, 28};
37 constexpr std::array limits{3,9,14,19,24,29,34,39};
151 if (property < 0)
return std::unexpected(
"European deed square is not ownable");
154 return std::unexpected(
"USA deed presentation requires USA English, classic board and US dollars");
156 return std::unexpected(
"European deed language must be UK..Norwegian (2..10)");
159 return std::unexpected(
"European deed board must be 0..11 or custom (-1)");
161 return std::unexpected(
"European deed currency must be 0..13");
163 return std::unexpected(
"European deed housesPerHotel must be 4 or 5");
175 const auto amount = [&](std::int64_t
value,
bool symbol =
true)
182 return std::string{};
187 int justification,
int size,
bool bold =
false,
194 int y,
int height,
bool symbol =
true)
201 text(
name, 27, 30, 1, 10,
true,
false,
false, 2);
202 text(
TRANS[12][language], 92, 15, 1, 15,
false,
false,
false, 2);
203 std::string
mortgage = amount(square.mortgageCost);
205 text(std::move(
mortgage), 109, 15, 1, 15,
false,
false,
false, 2);
206 text(
TRANS_MORT[language], 153, 30, 1, 15,
false,
true,
false, 2);
208 else if (property >= 26)
211 constexpr std::array
factors{0,3,2,3,3,2,2,2,2,2,1,0,0,0};
218 pair(
TRANS[7][language], square.mortgageCost, 200, 12);
221 else if (property >= 22)
225 square.rent[1], 92, 14);
226 for (
int i = 2;
i <= 4; ++
i)
227 pair(
TRANS[11 +
i][language], square.rent[
i], 110 + (
i - 2) * 18,
229 pair(
TRANS[7][language], square.mortgageCost, 164, 14);
236 text(
name, 18, 32, 1, 10,
true,
false,
true);
237 text(std::string(
TRANS[1][language]) +
" " + amount(square.rent[0]),
238 56, 12, 1, 12,
true);
239 for (
int i = 1;
i <= 5; ++
i)
242 68 + (
i - 1) * 12, 12,
i == 1);
244 pair(
TRANS[7][language], square.mortgageCost, 130, 12);
245 pair(
TRANS[8][language], square.housePurchaseCost, 142, 12);
246 pair(
TRANS[9][language], square.housePurchaseCost, 154, 12);
247 text(
TRANS[10][language], 166, 12, 2, 12);
255 std::expected<data::LegacyBitmapRGBA8, std::string>
render(
258 const auto layout =
plan(request);
259 if (!layout)
return std::unexpected(layout.error());
260 if (!fonts.
ready())
return std::unexpected(
"European deed requires configured retail Arial");
261 if (!
resolveTemplate)
return std::unexpected(
"European deed template resolver is missing");
263 if (!background)
return std::unexpected(background.error());
264 if (!*background)
return std::unexpected(
"European deed template is empty");
265 if ((*background)->image.width !=
Width || (*background)->image.height !=
Height)
266 return std::unexpected(
"European deed template must be 199x227");
268 std::vector<std::uint8_t>(
Width *
Height * 4, 255)};
272 for (
const auto& fill : layout->fills)
274 for (
int y = fill.y;
y < fill.y + fill.height; ++
y)
275 for (
int x = fill.x;
x < fill.x + fill.width; ++
x)
277 const auto pixel =
static_cast<std::size_t
>((
y *
Width +
x) * 4);
278 image.pixels[
pixel] =
static_cast<std::uint8_t
>(fill.color);
279 image.pixels[
pixel + 1] =
static_cast<std::uint8_t
>(fill.color >> 8U);
280 image.pixels[
pixel + 2] =
static_cast<std::uint8_t
>(fill.color >> 16U);
285 for (
const auto&
region : layout->text)