// City Industry window data KAT (ui/industry_view.hpp): the 11 per-sector values read from the right // MISC offsets (recovered from the original's load order: industry block at dword 91+3i), for each // radio mode. Verified against LONDON's known figures. Skips without the city. #include "sc2k/io/sc2_file.hpp" #include "sc2k/render/asset_loader.hpp" #include "sc2k/ui/industry_view.hpp" #include #include #include #include "test_harness.hpp" #include "test_paths.hpp" int main() { using namespace sc2k; CHECK(std::string(ui::industry_name(0)) == "Steel/Mining"); CHECK(std::string(ui::industry_name(9)) == "Electronics"); CHECK(std::string(ui::industry_name(10)) == "Tourism"); const std::string p = city_file("LONDON.SC2"); if (!exists(p)) { std::printf("industry: name table OK; SKIP city (no LONDON)\n"); return failures ? 1 : 0; } City c; CHECK(io::load_sc2(p, c).ok); const auto pop = ui::industry_values(c, 0); // Ratios = population const auto dem = ui::industry_values(c, 2); // Demand // LONDON's known figures (verified vs the original): Electronics dominates pop + demand; Food tiny. CHECK(pop[9] == 570 && dem[9] == 82); // Electronics CHECK(pop[3] == 12); // Food CHECK(pop[10] == 400); // Tourism // Electronics is the largest sector by population (its bar is the longest). int argmax = 0; for (int i = 1; i < 11; ++i) if (pop[i] > pop[argmax]) argmax = i; CHECK(argmax == 9); std::printf("industry: LONDON Electronics pop=%d demand=%d (largest sector) — offsets verified\n", pop[9], dem[9]); if (failures == 0) { std::printf("industry: all checks passed\n"); return 0; } std::printf("industry: %d failure(s)\n", failures); return 1; }