Reset geography and volcano state on rebuild
This commit is contained in:
parent
8ae2f14bae
commit
842a7b4229
@ -54,6 +54,10 @@ void Planet::buildGeometry() {
|
||||
sHasBiota = false;
|
||||
sHumidity.clear(); sCloud.clear(); sRain.clear(); // weather spins up on entering Live World
|
||||
sHasWeather = false; sStorms.clear();
|
||||
geoFeatures.clear(); sGeoRng = cfg.seed ? (cfg.seed ^ 0x6E0C12A7u) : 0x6E0C12A7u;
|
||||
sCellLand.assign(cells.size(), -1); sCellWater.assign(cells.size(), -1);
|
||||
sCellRange.assign(cells.size(), -1); sCellRiver.assign(cells.size(), -1);
|
||||
volcanoes.clear(); sVolRng = cfg.seed ? (cfg.seed ^ 0x70C4F12Au) : 0x70C4F12Au;
|
||||
}
|
||||
|
||||
void Planet::clearDerivedState() {
|
||||
|
||||
@ -68,6 +68,26 @@ int main() {
|
||||
check(continents + islands >= 1, "at least one land mass");
|
||||
check(oceans >= 1, "at least one ocean");
|
||||
|
||||
std::printf("Geography: rebuild clears stale atlas state\n");
|
||||
{
|
||||
Planet r; r.generate(cfg); settle(r); drift(r, 40); r.generateGeography();
|
||||
check(!r.geography().empty(), "regression setup builds an atlas");
|
||||
Volcano stale{}; stale.cell = 0; r.volcanoes.push_back(stale);
|
||||
PlanetConfig next = cfg; next.seed = cfg.seed + 1;
|
||||
r.generate(next);
|
||||
bool landEmpty = !r.cellLand().empty()
|
||||
&& std::all_of(r.cellLand().begin(), r.cellLand().end(), [](int v) { return v == -1; });
|
||||
bool waterEmpty = !r.cellWater().empty()
|
||||
&& std::all_of(r.cellWater().begin(), r.cellWater().end(), [](int v) { return v == -1; });
|
||||
bool rangeEmpty = !r.cellRange().empty()
|
||||
&& std::all_of(r.cellRange().begin(), r.cellRange().end(), [](int v) { return v == -1; });
|
||||
bool riverEmpty = !r.cellRiver().empty()
|
||||
&& std::all_of(r.cellRiver().begin(), r.cellRiver().end(), [](int v) { return v == -1; });
|
||||
check(!r.geographyBuilt() && r.geography().empty(), "generate() clears the old atlas");
|
||||
check(landEmpty && waterEmpty && rangeEmpty && riverEmpty, "generate() resets per-cell feature indices");
|
||||
check(r.volcanoes.empty(), "generate() clears stale volcanoes");
|
||||
}
|
||||
|
||||
std::printf("Geography: per-cell membership consistency\n");
|
||||
const auto& land = p.cellLand(); const auto& water = p.cellWater();
|
||||
const auto& range = p.cellRange();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user