Fix Super-Stadion full-upgrade image selection (by Codex)
This commit is contained in:
1 parent
8b3b51de55
commit
a207b0129e
4 files changed
+105
-11
No files matched your search
@@ -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];
|
||||
|
||||
@@ -34,15 +34,20 @@ Json demo_stadium_quote(const Json &state, const Json &request, const Catalog &,
|
||||
// labels are 1-based with an empty entry at index 0. No artwork is required.
|
||||
Json demo_stadium_rules(const Catalog &);
|
||||
// {ok,club,club_name,name,stadium,budget,budget_cap,pending_cost,
|
||||
// available_capacity,planned_capacity,capacity,blocks,facilities}.
|
||||
// available_capacity,planned_capacity,capacity,physical_capacity,super_stadium,
|
||||
// blocks,facilities,periphery}.
|
||||
// Rule rows above are augmented with unchanged base values/job/building plus
|
||||
// display_places/seats/roof or display_level/label for the requested view.
|
||||
// Current capacity excludes a block with any pending job; future uses its target.
|
||||
// super_stadium requires every block at its own maximum with seats and roof:
|
||||
// completed values in Current, queued targets where present in Future.
|
||||
// Stadium identity comes from the catalogue, not its initialization policies.
|
||||
Json demo_stadium_view(const Json &state, const Catalog &, bool future = false,
|
||||
const std::string &club = {});
|
||||
// Pure calibrated sprite layout. Ignores exported simulation/editor/object state;
|
||||
// uses only runtime overview capacity and periphery jobs. Coordinates remain in
|
||||
// uses only runtime overview capacity/full-upgrade status and periphery jobs.
|
||||
// Five ordinary capacity images remain; the sixth requires super_stadium.
|
||||
// Coordinates remain in
|
||||
// the 1920x1080 reference space; stable layers include full transparent canvases.
|
||||
Json demo_stadium_scene(const Json &configuration, const Json &overview, bool future);
|
||||
} // namespace bmh::modern_ui
|
||||
Reference in new issue
Block a user