1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-18 06:30:41 +00:00

relhell:: ads:: better optimized cell creation

This commit is contained in:
Zeno Rogue 2024-10-01 22:17:59 +02:00
parent 3700acaf56
commit 7769ff16f6

View File

@ -66,11 +66,14 @@ map<int, int> genstats;
int gen_budget;
void gen_terrain(cell *c, cellinfo& ci, int level = 0) {
setdist(c, 7, nullptr);
if(level == 0) setdist(c, 7, nullptr);
if(level >= ci.mpd_terrain) return;
if(!hyperbolic) { println(hlog, "wrong geometry detected in gen_terrain!"); exit(1); }
if(ci.mpd_terrain > level + 1) gen_terrain(c, ci, level+1);
forCellCM(c1, c) gen_terrain(c1, ci_at[c1], level+1);
if(c->land == laCaves) {
if(ci.mpd_terrain > level + 1) gen_terrain(c, ci, level+1);
forCellCM(c1, c) gen_terrain(c1, ci_at[c1], level+1);
}
genstats[level]++;
if(level == 2) {
@ -101,7 +104,7 @@ void add_rock(cell *c, cellinfo& ci, const ads_matrix& T) {
bool fail = false;
compute_life(hybrid::get_at(c, 0), unshift(T), [&] (cell *c, ld t) {
setdist(c, 7, nullptr);
hybrid::in_underlying_geometry([c] { setdist(c, 7, nullptr); });
if(c->land == laBarrier) fail = true;
return false;
});