Something went wrong. Try again.
[Mirror] Libreopolis is a cross-platform city simulation game fully compatible with SimCity 2000. gitlab.com/conasg/libreopolis
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495// Disaster lifecycle KAT — the Fire effect-overlay ported from the original's disaster tick +// its creator / ignite / burn-out primitives. Everything here is// verified numerically (no SDL, no eyeballing): fire ignites on a building, spreads, razes structures,// and — crucially — TERMINATES (dwDisasterActive flips false), faster with more XFIR fire coverage.#include "sc2k/sim/disasters.hpp"#include "sc2k/sim/things.hpp" // spawn_monster / thing_despawn — the Thing keep-alive regression test#include "sc2k/city.hpp"#include "sc2k/rng.hpp"#include <cstdio>
using namespace sc2k;using namespace sc2k::sim;
#include "test_harness.hpp"
static int count_fire(const City& c) { int n = 0; for (int i = 0; i < City::kDim; ++i) for (int j = 0; j < City::kDim; ++j) if (c.xtxt.at(i, j) == fx::Fire) ++n; return n;}static int count_buildings(const City& c) { int n = 0; for (int i = 0; i < City::kDim; ++i) for (int j = 0; j < City::kDim; ++j) if (c.xbld.at(i, j) >= 0x70) ++n; return n;}static int count_code(const City& c, std::uint8_t code) { int n = 0; for (int i = 0; i < City::kDim; ++i) for (int j = 0; j < City::kDim; ++j) if (c.xtxt.at(i, j) == code) ++n; return n;}
// A dense downtown: a region of buildings whose codes vary per tile, so the simplified connected-// component demolish razes one tile at a time (distinct neighbours) — what we want for spread testing.static void fill_downtown(City& c, int r0, int c0, int n) { for (int r = r0; r < r0 + n; ++r) for (int col = c0; col < c0 + n; ++col) c.xbld.at(r, col) = std::uint8_t(0x70 + ((r * 3 + col * 5) & 0x1F)); // 0x70..0x8F, varied}
// Run a fire to completion; return the tick count (or -1 if it never terminated within the cap).static int run_to_quiescence(City& c, DisasterSim& d, MsRand& rng, int cap) { for (int t = 1; t <= cap; ++t) if (!disaster_tick(c, d, rng)) return t; return -1;}
int main() { // ---- ignite primitive ---- { City c; c.xbld.at(40, 40) = 0x80; // a building CHECK(sim::detail::ignite(c, 40, 40, 0) == 1); CHECK(c.xtxt.at(40, 40) == fx::Fire); CHECK(sim::detail::ignite(c, 40, 40, 0) == 0); // already on fire → no-op
c.xbit.at(10, 10) = 0x04; // water CHECK(sim::detail::ignite(c, 10, 10, 1) == 0); // never ignites water, even forced CHECK(sim::detail::ignite(c, 20, 20, 0) == 0); // bare ground, unforced → no CHECK(sim::detail::ignite(c, 20, 20, 1) == 1); // bare ground, forced → yes (creator fallback) }
// ---- finalize_burn: clears the fire, and razes a fully-built zone tile ---- { City c; DisasterSim d; c.xbld.at(50, 50) = 0x90; c.xzon.at(50, 50) = 0xF0; // fully-built zone tile (XZON high nibble 0xF0) c.xtxt.at(50, 50) = fx::Fire; sim::detail::finalize_burn(c, d, 50, 50); CHECK(c.xtxt.at(50, 50) == 0); // fire out CHECK(c.xbld.at(50, 50) < 0x70); // built zone tile demolished to rubble // A bare-rubble fire tile (XBLD already razed) just gets its fire cleared. City c2; DisasterSim d2; c2.xbld.at(60, 60) = 2; c2.xtxt.at(60, 60) = fx::Fire; // a Rubble-2 tile already alight sim::detail::finalize_burn(c2, d2, 60, 60); CHECK(c2.xtxt.at(60, 60) == 0); }
// ---- creator: lights exactly one building near the city centre ---- { City c; DisasterSim d; MsRand rng(12345); fill_downtown(c, 58, 58, 12); // centred around (64,64) CHECK(start_fire(c, d, rng)); CHECK(d.active && d.type == 1); CHECK(count_fire(c) >= 1); // the ignition sits inside (or adjacent to) the built area, not off in an empty corner bool near = false; for (int i = 50; i < 80 && !near; ++i) for (int j = 50; j < 80 && !near; ++j) if (c.xtxt.at(i, j) == fx::Fire) near = true; CHECK(near); }
// ---- full lifecycle: spreads, damages the city, and TERMINATES ---- { City c; DisasterSim d; MsRand rng(0xBEEF); fill_downtown(c, 40, 40, 16); const int before = count_buildings(c); CHECK(start_fire(c, d, rng));
int peak = 0; for (int t = 0; t < 200; ++t) { disaster_tick(c, d, rng); peak = peak > count_fire(c) ? peak : count_fire(c); } CHECK(peak >= 2); // it spread beyond the single ignition
const int extra = run_to_quiescence(c, d, rng, 60000); CHECK(extra > 0); // it ended (did not burn forever) CHECK(!d.active); CHECK(count_fire(c) == 0); // no effect tiles linger CHECK(count_buildings(c) < before); // the fire actually destroyed structures std::printf(" fire razed %d/%d buildings, quiesced after spreading\n", before - count_buildings(c), before); }
// ---- firefighting: more XFIR coverage ⇒ the fire is put out sooner ---- // Start both runs from an identical, sizeable conflagration (a 12×12 block already alight) so the // only variable is fire-department coverage — isolating the XFIR-gated burn-out roll. { auto trial = [](std::uint8_t coverage) { City c; DisasterSim d; MsRand rng(0x1234); // identical seed/state both runs fill_downtown(c, 40, 40, 16); for (int r = 44; r < 56; ++r) for (int col = 44; col < 56; ++col) c.xtxt.at(r, col) = fx::Fire; d.active = true; d.type = 1; for (int i = 0; i < 32; ++i) for (int j = 0; j < 32; ++j) c.xfir.at(i, j) = coverage; return run_to_quiescence(c, d, rng, 60000); }; const int slow = trial(0x00); // no fire department const int fast = trial(0xF0); // saturated fire coverage CHECK(slow > 0 && fast > 0); CHECK(fast < slow); // coverage demonstrably shortens the disaster std::printf(" ticks to extinguish: no-coverage=%d full-coverage=%d\n", slow, fast); }
// ---- Flood: a SMALL source — a ~5-tile water cross at a terrain edge/shore, NO citywide // scatter and NO up-front demolition. The flood accrues over the 60-frame timer as the tick walks the // water downhill and submerges/razes what it settles on; then it TERMINATES. (Long mislabeled // "earthquake" in this port — it writes 0xFC = spec "Flood".) ---- { City c; DisasterSim d; MsRand rng(0x5EED); for (int r = 24; r < 104; ++r) for (int cc = 24; cc < 104; ++cc) // a big dense city c.xbld.at(r, cc) = std::uint8_t(0x70 + ((r * 3 + cc * 5) & 0x1F)); const int before = count_buildings(c); CHECK(start_flood(c, d, rng)); CHECK(d.active && d.type == 2); CHECK(d.effectTimer == 60); const int seed = count_code(c, fx::Flood); CHECK(seed >= 1 && seed <= 5); // a single source cross, NOT a citywide scatter CHECK(count_buildings(c) == before); // the source razes nothing up front
int peakFlood = seed; for (int t = 0; t < 60; ++t) { disaster_tick(c, d, rng); peakFlood = std::max(peakFlood, count_code(c, fx::Flood)); } CHECK(peakFlood > seed); // the flood spread out from the source
const int ticks = run_to_quiescence(c, d, rng, 60000); CHECK(ticks > 0); // the flood ended (didn't run forever) CHECK(!d.active); CHECK(count_code(c, fx::Flood) == 0); // no flood water lingers CHECK(count_buildings(c) < before); // it razed buildings as it spread std::printf(" flood seeded %d, peaked %d, razed %d/%d buildings, quiesced after %d ticks\n", seed, peakFlood, before - count_buildings(c), before, ticks); } // The flood source is ONE localised cluster (fits a 3×3 box), not water strewn across the map — the // regression for the old "covered the whole city in fire" bug (which traced to this creator's mislabel). { City c; DisasterSim d; MsRand rng(0xEEE); for (int r = 0; r < City::kDim; ++r) for (int cc = 0; cc < City::kDim; ++cc) c.xbld.at(r, cc) = 0x80; start_flood(c, d, rng); int minR = 999, maxR = -1, minC = 999, maxC = -1; for (int i = 0; i < City::kDim; ++i) for (int j = 0; j < City::kDim; ++j) if (c.xtxt.at(i, j) == fx::Flood) { minR = std::min(minR, i); maxR = std::max(maxR, i); minC = std::min(minC, j); maxC = std::max(maxC, j); } CHECK(maxR >= 0); // something seeded CHECK(maxR - minR <= 2 && maxC - minC <= 2); // and it's one epicentre, not the whole map }
// ---- Riot (creator ×3 + tick 253/254): seeds Rioters fronts (0xFD/0xFE) on a street near the // centre, the mob then MARCHES along it CLEARING TRAFFIC + sparking the odd fire, and disperses — so it // terminates. A bounded road line (rest of the map non-riotable) keeps it finite. THE TASK'S RIOT KAT. // (Long mislabeled "flood" in this port — it writes 0xFD/0xFE = spec "Rioters".) ---- { City c; DisasterSim d; MsRand rng(0xF100D); for (int cc = 30; cc < 98; ++cc) c.xbld.at(64, cc) = 0x1D; // one E–W street through centre (row 64) for (int k = 15; k < 49; ++k) c.xtrf.at(32, k) = 200; // heavy traffic on it (half-res row 64/2 = 32) CHECK(start_riot(c, d, rng)); CHECK(d.active && d.type == 3); CHECK(count_code(c, fx::RiotNW) + count_code(c, fx::RiotSE) >= 1); // a Rioters front was seeded CHECK(count_code(c, fx::Fire) == 0); // a riot is 0xFD/0xFE, not 0xFF up front
int peak = 0, steps = 0; for (; steps < 8000; ++steps) { const int n = count_code(c, fx::RiotNW) + count_code(c, fx::RiotSE); peak = std::max(peak, n); if (steps > 0 && n == 0) break; // the mob dispersed disaster_tick(c, d, rng); } CHECK(peak >= 2); // it marched along the street CHECK(steps < 8000); // and dispersed (the riot terminates) CHECK(count_code(c, fx::RiotNW) == 0 && count_code(c, fx::RiotSE) == 0); // the riot's signature (tick case 253/254 sets xtrf=0): it cleared traffic on streets it passed. int trafficLeft = 0; for (int k = 15; k < 49; ++k) trafficLeft += c.xtrf.at(32, k); CHECK(trafficLeft < 200 * (49 - 15)); // some traffic was cleared by the marching mob std::printf(" riot peaked at %d front tiles, dispersed after %d ticks (traffic %d→%d)\n", peak, steps, 200 * (49 - 15), trafficLeft); }
// ---- Toxic cloud / firestorm (tick case 251): a 0xFB front ruins buildings, walks downhill, burns out ---- { City c; DisasterSim d; MsRand rng(0xF12E); fill_downtown(c, 40, 40, 40); for (int r = 55; r < 65; ++r) for (int cc = 55; cc < 65; ++cc) c.xtxt.at(r, cc) = fx::ToxicCloud; const int before = count_buildings(c); int steps = 0; for (; steps < 20000; ++steps) { disaster_tick(c, d, rng); if (count_code(c, fx::ToxicCloud) == 0) break; } CHECK(steps < 20000); // the fronts all burned out CHECK(count_code(c, fx::ToxicCloud) == 0); CHECK(count_buildings(c) < before); // and razed buildings on the way std::printf(" toxic cloud razed %d buildings, dissipated after %d ticks\n", before - count_buildings(c), steps); }
// ---- Volcano (disaster type 0x0B): the genuinely weird one (long mislabeled "riot"; the real riot is start_riot above). It // builds a terrain cone by driving the editor's raise-tile primitive on a fake $25000 budget. Verify // numerically: a mountain rises, the cone has no cliffs (orthogonally-adjacent altitudes differ by ≤1), // it's capped at 30, fire is scattered, the height is budget-determined, and the treasury is untouched. ---- { City c; DisasterSim d; MsRand rng(0xC0DE); const long funds0 = c.funds(); for (std::size_t i = 0; i < std::size_t(City::kDim) * City::kDim; ++i) { // a flat, dry, level-2 plain… c.altm.cells[i] = 2; c.xbit.cells[i] &= 0xFB; // clear the water bit (XBIT bit2) c.xzon.cells[i] = 0x13; // …fully zoned (low nibble) + corner bits c.xbld.cells[i] = 0x70; // …and built over (XBLD also holds roads 0x1D-0x2C / trees 6-0xD) } CHECK(start_volcano(c, d, rng)); CHECK(d.active && d.type == 0x0B); CHECK(d.volcanoBudget == 25000); // armed but NOT yet built — the cone grows gradually { int fr, fc; CHECK(disaster_focus(c, d, fr, fc) && fr == d.volcanoX && fc == d.volcanoY); } // Goto target = the vent int ticks = 0; // build to completion over disaster ticks while (d.volcanoBudget > 0 && ticks < 2000) { disaster_tick(c, d, rng); ++ticks; } CHECK(d.volcanoBudget <= 0); // growth finished CHECK(ticks >= 4); // it climbed over SEVERAL ticks (gradual, not instant) int peak = 0, raised = 0, cliffs = 0, draggedUp = 0; for (int r = 0; r < City::kDim; ++r) for (int cc = 0; cc < City::kDim; ++cc) { const int a = c.altm.at(r, cc) & 0x1F; if (a > peak) peak = a; if (a > 2) { ++raised; if (c.xbld.at(r, cc) >= 6 || (c.xzon.at(r, cc) & 0x0F) != 0) ++draggedUp; } if (r + 1 < City::kDim) { int e = a - (c.altm.at(r + 1, cc) & 0x1F); if (e > 1 || e < -1) ++cliffs; } if (cc + 1 < City::kDim) { int e = a - (c.altm.at(r, cc + 1) & 0x1F); if (e > 1 || e < -1) ++cliffs; } } CHECK(cliffs == 0); // the lower-neighbour cascade + reslope keep steps ≤ 1 CHECK(peak > 2 && peak <= 30); // a mountain rose, capped at 30 (level < 30) CHECK(peak >= 8 && peak <= 16); // budget-determined height (~12 for $25000; uncalibrated band) CHECK(draggedUp == 0); // raised tiles cleared to bare/rubble — no structures/zones dragged up CHECK(count_code(c, fx::Fire) + count_code(c, fx::ToxicCloud) > 0); // fire/firestorm scattered CHECK(c.funds() == funds0); // the eruption is free — the original saves/restores the treasury // Rubble only survives on FLAT ground (deviation): the cone's re-sloped tiles shed the rubble the // eruption's demolition left, instead of strewing overlapping piles across the slopes. Rubble on // tiles that stayed flat is untouched (so the eruption still visibly leaves debris). int rubbleOnSlope = 0, rubbleOnFlat = 0; for (int r = 0; r < City::kDim; ++r) for (int cc = 0; cc < City::kDim; ++cc) { const int xb = c.xbld.at(r, cc), xt = c.xter.at(r, cc); if (xb < 1 || xb > 4 || xt >= 0x10) continue; if ((xt & 0x0F) != 0 && (xt & 0x0F) != 0x0D) { if (++rubbleOnSlope <= 8) std::printf(" rubble-on-slope (%d,%d): XTER=0x%02X XBLD=%d alt=%d\n", r, cc, xt, xb, c.altm.at(r, cc) & 0x1F); } else ++rubbleOnFlat; } CHECK(rubbleOnSlope == 0); // sloped tiles shed rubble (terrain_autotile_cell) CHECK(rubbleOnFlat > 0); // …but flat debris around the cone survives std::printf(" volcano: built over %d ticks → peak=%d, %d raised tiles cleared (gradual, no cliffs, free; rubble flat=%d slope=%d)\n", ticks, peak, raised, rubbleOnFlat, rubbleOnSlope); } // ---- Volcano gate: never raises into water / off the map / past the cap — which is what // makes the cone's height TERRAIN-dependent (the famous "random" 2–11) rather than a fixed size. ---- { City c; for (std::size_t i = 0; i < std::size_t(City::kDim) * City::kDim; ++i) { c.altm.cells[i] = 4; c.xbit.cells[i] &= 0xFB; c.xzon.cells[i] = 0; } c.xbit.at(40, 40) |= 0x04; // a lone water tile CHECK(!volcano_can_raise(c, 40, 40)); // can't raise water itself CHECK(!volcano_can_raise(c, 40, 41)); // …nor a tile adjacent to water CHECK(volcano_can_raise(c, 10, 10)); // open dry land → yes c.altm.at(60, 60) = std::uint16_t((c.altm.at(60, 60) & ~0x1F) | 30); // a tile already at the cap CHECK(!volcano_can_raise(c, 60, 60)); // can't raise past 30 CHECK(volcano_can_raise(c, 42, 40)); // flat tile 2 from water (no downhill) → ok c.altm.at(41, 40) = std::uint16_t((c.altm.at(41, 40) & ~0x1F) | 3); // carve a downhill step toward the water CHECK(!volcano_can_raise(c, 42, 40)); // now its down-slope chain reaches the sea → refused std::printf(" volcano gate: water / water-adjacent / capped / down-slope-to-water tiles correctly refused\n"); }
// ---- Earthquake: the shock scatters bounded damage (demolish + fire) over a wide area // INSTANTLY, with no lingering effect-tile spread. (Long mislabeled "hurricane" in this port.) ---- { City c; DisasterSim d; MsRand rng(0x4717); fill_downtown(c, 34, 34, 60); const int before = count_buildings(c); CHECK(start_earthquake(c, d, rng)); CHECK(d.active && d.type == 6); CHECK(count_buildings(c) < before); // it tore down a swath of buildings CHECK(count_code(c, fx::Flood) == 0); // a quake writes NO 0xFC water (that's the flood/hurricane) std::printf(" quake flattened %d buildings\n", before - count_buildings(c)); }
// ---- Mass Riots (type 0x0D — debug "Mass Riots"): scatters pop/10000+5 single-riot fronts // about the centre, each seeded on a street; they march and disperse → terminates. ---- { City c; DisasterSim d; MsRand rng(0x2107); for (int r = 40; r < 88; r += 4) for (int cc = 40; cc < 88; ++cc) c.xbld.at(r, cc) = 0x1D; // streets every 4 rows CHECK(start_mass_riots(c, d, rng)); CHECK(d.active && d.type == 0x0D); const int fronts = count_code(c, fx::RiotNW) + count_code(c, fx::RiotSE); CHECK(fronts >= 1); // several riot fronts seeded (pop 0 → the +5 floor) const int ticks = run_to_quiescence(c, d, rng, 60000); CHECK(ticks > 0 && !d.active); // they march and disperse std::printf(" mass riots seeded %d fronts, quiesced after %d ticks\n", fronts, ticks); }
// ---- Hurricane (type 0x10): a MAP-WIDE storm — wind wreckage up front + storm-surge flood // (0xFC) seeds + the spread / re-ignition timers; then it passes. (Long mislabeled "meltdown firestorm".) ---- { City c; DisasterSim d; MsRand rng(0x4CA4); for (int r = 16; r < 112; ++r) for (int cc = 16; cc < 112; ++cc) c.xbld.at(r, cc) = std::uint8_t(0x70 + ((r * 3 + cc * 5) & 0x1F)); const int before = count_buildings(c); CHECK(start_hurricane(c, d, rng)); CHECK(d.active && d.type == 0x10); CHECK(d.effectTimer == 60 && d.aftershock == 50); // effect + aftershock timers CHECK(count_code(c, fx::Flood) >= 1); // storm-surge flood water seeded CHECK(count_buildings(c) < before); // wind wreckage up front const int ticks = run_to_quiescence(c, d, rng, 60000); CHECK(ticks > 0 && !d.active); // the storm passes std::printf(" hurricane razed %d/%d buildings, passed after %d ticks\n", before - count_buildings(c), before, ticks); }
// ---- demolish() footprint bound: razes ONE building's N×N footprint, NOT a run of abutting same-code // buildings (the over-clear behind meltdowns/tornadoes wiping whole neighbourhoods) ---- { City c; for (int r = 20; r < 28; ++r) for (int cc = 20; cc < 28; ++cc) c.xbld.at(r, cc) = 0xCB; // 8×8 of one code (size 4) const int before = count_buildings(c); sim::detail::demolish(c, 24, 24, /*lightFire=*/false); CHECK(before == 64); CHECK(before - count_buildings(c) == 16); // exactly one 4×4 footprint, not the whole 8×8 blob std::printf(" demolish razed %d tiles of an 8x8 same-code blob (footprint-bounded to 16)\n", before - count_buildings(c)); }
// ---- Thing keep-alive (the scan at the tail of the original's disaster driver): a Thing-based // disaster (monster/tornado/explosion) has NO effect tiles, yet the disaster must stay active while the // Thing lives — the regression behind "the monster spawns, the disaster instantly subsides, and it // freezes in place until the next disaster unsticks it". ---- { City c; DisasterSim d; MsRand rng(0x60D2); const int idx = spawn_monster(c, rng, 40, 40); CHECK(idx > 0); d.active = true; d.type = 8; // exactly what the app's trigger path does CHECK(disaster_tick(c, d, rng)); // no effect tiles, but the monster keeps it live CHECK(d.active); thing_despawn(c, idx); // monster gone → CHECK(!disaster_tick(c, d, rng)); // …the disaster may now subside CHECK(!d.active); std::printf(" monster kept the disaster active with zero effect tiles; ended on despawn\n"); }
// ---- Hurricane sweep edges (the original's 4-way switch on (compass+1)&3): wreckage + storm surge // blow in from a compass-picked edge, and the wreckage NEVER burns — the effect writer is called // with fire=0 in all four cases (the a3=1 on cases 0/3 is only the demolition poof animation; misreading // it as fire made every hurricane end in a firestorm — user-reported, now locked out here). ---- { for (int sweep = 0; sweep < 4; ++sweep) { City c; DisasterSim d; MsRand rng(0x45D4); for (int r = 16; r < 112; ++r) for (int cc = 16; cc < 112; ++cc) c.xbld.at(r, cc) = std::uint8_t(0x70 + ((r * 3 + cc * 5) & 0x1F)); const int before = count_buildings(c); CHECK(start_hurricane(c, d, rng, sweep)); CHECK(count_buildings(c) < before); // wreckage on every edge CHECK(count_code(c, fx::Flood) >= 1); // storm surge on every edge CHECK(count_fire(c) == 0); // a hurricane never starts fires — on ANY edge } std::printf(" hurricane: wreckage+surge on all 4 sweep edges, zero fire on all 4\n"); }
// Runtime-sized searches and random coordinates stay in range on Tiny, and hurricane scan lines // use the portion of a Medium map beyond coordinate 127. { City tiny(MapSize::Tiny); DisasterSim d; MsRand rng(0x2A19); CHECK(!start_fire(tiny, d, rng, 32, 32)); // exhausts both the spiral and random fallback CHECK(start_flood(tiny, d, rng, 32, 32)); // no shore: runtime-sized spiral falls back safely CHECK(start_hurricane(tiny, d, rng, 0)); for (int i = 0; i < 60; ++i) disaster_tick(tiny, d, rng); // includes runtime-sized aftershock picks
City medium(MapSize::Medium); DisasterSim md; MsRand mrng(0x45D4); for (int r = 0; r < medium.dimension(); ++r) for (int col = 0; col < medium.dimension(); ++col) medium.xbld.at(r, col) = 0x80; CHECK(start_hurricane(medium, md, mrng, 2)); int changedBeyond127 = 0; for (int r = 0; r < medium.dimension(); ++r) for (int col = 0; col < medium.dimension(); ++col) if ((r >= 128 || col >= 128) && (medium.xbld.at(r, col) != 0x80 || medium.xtxt.at(r, col) == fx::Flood)) ++changedBeyond127; CHECK(changedBeyond127 > 0); }
if (failures == 0) { std::printf("disasters: all checks passed\n"); return 0; } std::printf("disasters: %d failure(s)\n", failures); return 1;}