The stadium model shows the stages of lounge and periphery

Clubhouse and shopping centre grow a storey per stage, the car park grows
along the road, the restaurant gets a second storey and the lounge a wider,
second row of glass. A crane stands while a stage is built. The card of a
building names its stage, what it brings and what the next one costs, and
orders it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-17 19:09:27 +01:00
1 parent 8be27f8e57
commit dfe8a43440
8 files changed
+82 -34

No files matched your search

+18 -8
View File
@@ -198,9 +198,16 @@ inline Scene build(const Json &overview, bool future, const std::string &sign) {
const auto around = [&](size_t i) -> const Json & { return i < periphery.size() ? periphery[i] : none; };
// levels count from 1; the model draws from 0
const auto grade = [&](size_t i) { const auto &f = facility(i); return std::clamp(f.value("display_level", f.value("level", 1)) - 1, 0, 3); };
const auto level = [&](size_t i) { const auto &p = around(i); return std::max(0, p.value("display_level", p.value("level", 0))); };
const auto most = [&](size_t i) { return std::max(1, around(i).value("max_level", 1)); };
const auto busy = [&](const Json &row) { return !future && row.value("building", false); };
// a building that Modern extends in stages (stage 1 = as built) is drawn by its stage; in the
// view of the future the stage under construction counts as finished
const auto stage_of = [&](const Json &row) { return row.contains("stage") ? row.value("stage", 0) + (future && row.value("expanding", false) && row.value("stage", 0) > 0 ? 1 : 0) : -1; };
const auto level = [&](size_t i) {
const auto &p = around(i);
const int built = std::max(0, p.value("display_level", p.value("level", 0)));
return stage_of(p) >= 0 && built > 0 ? std::max(1, stage_of(p)) : built;
};
const auto most = [&](size_t i) { return std::max(1, around(i).contains("stages") ? around(i).value("stages", 1) : around(i).value("max_level", 1)); };
const auto busy = [&](const Json &row) { return !future && (row.value("building", false) || row.value("expanding", false)); };
// ---- the stands: the four with the most room are the long and short sides ----
constexpr double G = 40, G2 = 58.5, H0 = 1.6;
@@ -345,10 +352,12 @@ inline Scene build(const Json &overview, bool future, const std::string &sign) {
hot("facility:1", bx - 1, box_quads(bx - 2, -bw, bx, bw, bz, bz + bh * 1.6));
// the lounge in the main stand; where there is none, its place is only marked
const bool lounge = facility(3).value("max_level", 2) > 2 || facility(3).value("display_level", facility(3).value("level", 1)) >= 2;
const int lounge_stage = lounge ? std::clamp(stage_of(facility(3)), 0, 4) : 0; // 0: not staged (the demo, an older engine)
const int lounge_size = facility(3).value("max_level", 2) <= 2 ? 2 : grade(3);
const double north_tall = 2.5 + depth_north * .6, vw = std::array<double, 5>{10, 16, 24, 34, 34}[size_t(std::clamp(lounge_size, 0, 4))], vy = -G - depth_north * .62, vz = H0 + (north_tall - H0) * .62;
BoxLook glass; glass.deco_y = windows_y(vy, -vw, vw, vz + .4, vz + 3, int(std::lround(vw / 2.2)), "#bfe0ea", .1); glass.top = "#e9dfc9";
items.push_back({-G - depth_north / 2 + .6, lounge ? paint(box(-vw, vy - 3.4, vw, vy, vz - .5, vz + 3.6, "#f6f0e2", glass))
const double lounge_rise = lounge_stage > 1 ? (lounge_stage - 1) * 1.5 : 0;
const double north_tall = 2.5 + depth_north * .6, vw = lounge_stage ? std::array<double, 5>{24, 20, 25, 30, 35}[size_t(lounge_stage)] : std::array<double, 5>{10, 16, 24, 34, 34}[size_t(std::clamp(lounge_size, 0, 4))], vy = -G - depth_north * .62, vz = H0 + (north_tall - H0) * .62;
BoxLook glass; glass.deco_y = windows_y(vy, -vw, vw, vz + .4, vz + 3, int(std::lround(vw / 2.2)), "#bfe0ea", .1) + (lounge_rise > 0 ? windows_y(vy, -vw, vw, vz + 3.5, vz + 3.2 + lounge_rise, int(std::lround(vw / 2.2)), "#d7ecf2", .1) : std::string()); glass.top = "#e9dfc9";
items.push_back({-G - depth_north / 2 + .6, lounge ? paint(box(-vw, vy - 3.4, vw, vy, vz - .5, vz + 3.6 + lounge_rise, "#f6f0e2", glass)) + (busy(facility(3)) && facility(3).value("expanding", false) ? crane(vw + 4, vy - 2, vz + 14) : std::string())
: poly({{-vw, vy, vz - .5}, {vw, vy, vz - .5}, {vw, vy, vz + 3.6}, {-vw, vy, vz + 3.6}}, "#ffffff", "fill-opacity=\".25\" stroke=\"#645c50\" stroke-width=\"1.1\" stroke-dasharray=\"4 3\"")});
hot("facility:3", -G - depth_north / 2 + .6, box_quads(-vw, vy - 3.4, vw, vy, vz - .5, vz + 3.6));
// three small houses in the corners of the forecourt: heating, comfort, upkeep
@@ -479,14 +488,15 @@ inline Scene build(const Json &overview, bool future, const std::string &sign) {
house(2, -46, -124, 44, -92, z, faces, "");
}
{
BoxLook look; look.top = "#a8452f"; look.deco_y = windows_y(-96, 66, 100, 1.2, 5, 6, "#bfe0ea", .2) + sign_y(72, -96, 7.6, "RESTAURANT", 5.4); look.deco_x = windows_x(100, -122, -96, 1.2, 5, 4, "#bfe0ea", .2);
const double rz = level(5) >= 2 ? 12 : 7; // stage two adds a storey
BoxLook look; look.top = "#a8452f"; look.deco_y = windows_y(-96, 66, 100, 1.2, 5, 6, "#bfe0ea", .2) + (rz > 7 ? windows_y(-96, 66, 100, 6.4, 10.4, 6, "#bfe0ea", .2) : std::string()) + sign_y(72, -96, rz + .6, "RESTAURANT", 5.4); look.deco_x = windows_x(100, -122, -96, 1.2, 5, 4, "#bfe0ea", .2) + (rz > 7 ? windows_x(100, -122, -96, 6.4, 10.4, 4, "#bfe0ea", .2) : std::string());
// tables under parasols in front of it
std::string terrace = paint(box(66, -96, 100, -86, 0, .6, "#d9b98a"));
for (const double x : {70.0, 78.0, 86.0, 94.0}) {
const auto q = project({x, -91, 3});
terrace += "<circle cx=\"" + num(q.x) + "\" cy=\"" + num(q.y) + "\" r=\"5\" fill=\"" + (int(x) % 16 > 7 ? "#c8733c" : "#f6ecd8") + "\" stroke=\"" + ink + "\" stroke-width=\".6\"/>" + line({x, -91, .6}, {x, -91, 3}, ink, .7);
}
house(5, 66, -122, 100, -96, 7, box(66, -122, 100, -96, 0, 7, "#f6f0e2", look), terrace);
house(5, 66, -122, 100, -96, rz, box(66, -122, 100, -96, 0, rz, "#f6f0e2", look), terrace);
}
{
const auto stall = [&](size_t index, double x, double y) {