Fix Super-Stadion full-upgrade image selection (by Codex)

This commit is contained in:
Codex committed 2026-10-26 20:39:14 +01:00
1 parent 8b3b51de55
commit a207b0129e
4 files changed
+105 -11

No files matched your search

+12 -1
View File
@@ -271,11 +271,15 @@ Json demo_stadium_view(const Json &state, const Catalog &world, bool future, con
}
auto rules = demo_stadium_rules(world);
int64_t pending = 0, available = 0, planned = 0;
bool super_stadium = true;
for (size_t i = 0; i < 8; ++i) {
const auto &base = stadium.at("blocks")[i];
const auto &job = base.at("job");
const bool building = !job.is_null();
const auto &display = future && building ? job : base;
super_stadium = super_stadium &&
display.at("places").get<int64_t>() == capacities[i] &&
display.at("seats").get<bool>() && display.at("roof").get<bool>();
auto &row = rules["blocks"][i];
for (const auto *key : {"places", "seats", "roof", "job"}) row[key] = base.at(key);
row["building"] = building;
@@ -305,6 +309,7 @@ Json demo_stadium_view(const Json &state, const Catalog &world, bool future, con
int64_t physical = 0;
for (const auto &block : stadium.at("blocks")) physical += block.at("places").get<int64_t>();
rules["physical_capacity"] = future ? planned : physical;
rules["super_stadium"] = super_stadium;
rules["ok"] = true; rules["club"] = id; rules["club_name"] = team ? world.name(*team) : "—";
rules["stadium"] = record ? record->at("id") : Json();
const auto name = record ? world.name(*record) : "";
@@ -339,8 +344,14 @@ Json demo_stadium_scene(const Json &configuration, const Json &overview, bool fu
place(profile.at("backgroundOptions")[0].at("variants").at(size_t(traffic)),
{{"x", background.at("offsetX")}, {"y", background.at("offsetY")}, {"scale", background.at("scale")}, {"z", 0}}, "background", "background");
const auto capacity = overview.at("physical_capacity").get<int64_t>();
// The sixth image is a fully upgraded bowl, not another capacity tier.
size_t stadium_index = 0;
for (const auto &threshold : profile.at("stadium").at("thresholds")) if (capacity >= threshold.get<int64_t>()) ++stadium_index;
if (overview.at("super_stadium").get<bool>()) stadium_index = 5;
else {
const auto &thresholds = profile.at("stadium").at("thresholds");
for (size_t i = 0; i < 4 && i < thresholds.size(); ++i)
if (capacity >= thresholds[i].get<int64_t>()) ++stadium_index;
}
place(profile.at("stadium").at("variants").at(stadium_index), profile.at("stadium").at("transform"), "stadium", "stadium");
for (size_t i = 0; i < 14; ++i) {
const auto &object = profile.at("objects")[i], &row = overview.at("periphery")[i];