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
@@ -213,15 +213,78 @@ void periphery() {
|
||||
}
|
||||
require(overlay&&marker,"Missing parking overlay or independent snack marker");
|
||||
for(const auto &layer:future.at("layers"))require(layer.at("role")!="overlay"&&layer.at("role")!="marker","Future preview retains construction overlay");
|
||||
auto overview=demo_stadium_view(state,world);const std::array<int,5> boundaries{10000,25000,50000,75000,100000};
|
||||
auto overview=demo_stadium_view(state,world);const std::array<int,4> boundaries{10000,25000,50000,75000};
|
||||
for(size_t i=0;i<boundaries.size();++i)for(int delta:{-1,0}) {overview["physical_capacity"]=boundaries[i]+delta;require(demo_stadium_scene(config,overview,false).at("stadium_index")==i+(delta==0),"Capacity boundary selects wrong stadium");}
|
||||
overview["physical_capacity"]=100000;
|
||||
require(demo_stadium_scene(config,overview,false).at("stadium_index")==4,"Capacity alone selected the reserved Super-Stadion image");
|
||||
require(config==keep,"Scene projection mutated calibrated export");
|
||||
auto block_state=defaults;build(block_state,block(0,4000),world);require(demo_stadium_view(block_state,world).at("physical_capacity")==36000&&demo_stadium_view(block_state,world,true).at("physical_capacity")==37000,"Closed block shrinks physical stadium artwork");
|
||||
}
|
||||
}
|
||||
void super_stadium() {
|
||||
for (int precision : {0, 2}) {
|
||||
Fixture fixture(precision);
|
||||
const auto &world = *fixture.world;
|
||||
Json full = Json::object();
|
||||
require(migrate_demo_stadium(full, world), "Initialize Super-Stadion fixture");
|
||||
const auto rules = demo_stadium_rules(world), config = scene_fixture();
|
||||
int maximum = 0;
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
const int places = rules.at("blocks")[i].at("max_places").get<int>();
|
||||
full["stadium"]["blocks"][i] = {{"places", places}, {"seats", true}, {"roof", true}, {"job", nullptr}};
|
||||
maximum += places;
|
||||
}
|
||||
require(maximum == 96000 && valid_demo_stadium(full, world), "Full block maxima or stadium fixture invalid");
|
||||
const auto verify = [&](const Json &state, bool future, bool expected) {
|
||||
const auto before = state;
|
||||
const auto view = demo_stadium_view(state, world, future);
|
||||
const auto scene = demo_stadium_scene(config, view, future);
|
||||
require(view.at("ok") == true && view.at("super_stadium") == expected,
|
||||
"Super-Stadion predicate ignores a block capacity/seat/roof boundary");
|
||||
require(scene.at("stadium_index") == (expected ? 5 : 4),
|
||||
"Full-upgrade status selected the wrong stadium image");
|
||||
require(view.at("periphery").size() == 14 && scene.at("areas").size() == 14 && state == before,
|
||||
"Super-Stadion projection changed periphery or source state");
|
||||
};
|
||||
verify(full, false, true);
|
||||
verify(full, true, true);
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
auto unroofed = full;
|
||||
unroofed["stadium"]["blocks"][i]["roof"] = false;
|
||||
verify(unroofed, false, false);
|
||||
verify(unroofed, true, false);
|
||||
auto standing = full;
|
||||
standing["stadium"]["blocks"][i]["seats"] = false;
|
||||
verify(standing, false, false);
|
||||
verify(standing, true, false);
|
||||
auto smaller = full;
|
||||
smaller["stadium"]["blocks"][i]["places"] = rules.at("blocks")[i].at("max_places").get<int>() - 1000;
|
||||
verify(smaller, false, false);
|
||||
verify(smaller, true, false);
|
||||
build(unroofed, block(int(i), rules.at("blocks")[i].at("max_places").get<int>(), true, true), world);
|
||||
verify(unroofed, false, false);
|
||||
verify(unroofed, true, true);
|
||||
}
|
||||
auto queued = full;
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
auto &base = queued["stadium"]["blocks"][i];
|
||||
base["places"] = rules.at("blocks")[i].at("max_places").get<int>() - 1000;
|
||||
base["seats"] = false;
|
||||
base["roof"] = false;
|
||||
}
|
||||
for (size_t i = 0; i < 8; ++i)
|
||||
build(queued, block(int(i), rules.at("blocks")[i].at("max_places").get<int>(), true, true), world);
|
||||
conserved(queued, world, precision ? 100 : 1);
|
||||
verify(queued, false, false);
|
||||
verify(queued, true, true);
|
||||
require(demo_stadium_view(queued, world).at("physical_capacity") == 88000 &&
|
||||
demo_stadium_view(queued, world, true).at("physical_capacity") == 96000,
|
||||
"Queued maximum was treated as already completed");
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
int main() try {
|
||||
currency(0); currency(2); periphery();
|
||||
currency(0); currency(2); periphery(); super_stadium();
|
||||
Fixture empty(0, false); Json state = {{"cash", 77}, {"ticket", 13}};
|
||||
require(migrate_demo_stadium(state, *empty.world) && valid_demo_stadium(state, *empty.world) && state.at("stadium").at("club") == "" && demo_stadium_view(state, *empty.world).at("stadium").is_null() && demo_stadium_view(state, *empty.world).at("name") == "Stadion", "Zero-club fixture invented identity or crashed");
|
||||
const auto saved = state; require(!migrate_demo_stadium(state, *empty.world, "club:missing") && state == saved, "Invalid explicit club accepted");
|
||||
|
||||
Reference in new issue
Block a user