diff --git a/arbitrile.cpp b/arbitrile.cpp index 4ebb65f0..66887a0f 100644 --- a/arbitrile.cpp +++ b/arbitrile.cpp @@ -1499,9 +1499,6 @@ struct hrmap_arbi : hrmap { transmatrix T = lxpush(.01241) * spin(1.4117) * lxpush(0.1241) * Id; arbi_matrix[origin] = make_pair(alt, T); altmap[alt].emplace_back(origin, T); - - if(!current.range) - current.range = auto_compute_range(origin->c7); } ~hrmap_arbi() { @@ -1999,7 +1996,7 @@ EX void convert() { ac.cscale = cgi.scalefactor; ac.boundary_ratio = 1; ac.floor_scale = cgi.hexvdist / cgi.scalefactor; - ac.range = cgi.base_distlimit; + ac.range = getDistLimit(); ac.shapes.clear(); ac.shapes.resize(N); diff --git a/cell.cpp b/cell.cpp index fe1a6230..c33b7cac 100644 --- a/cell.cpp +++ b/cell.cpp @@ -1744,7 +1744,7 @@ EX bool is_boundary(cell *c) { } /** compute the distlimit for a tessellation automatically */ -EX int auto_compute_range(cell *c) { +EX int auto_compute_range(cell *c) { if(sphere) { cgi.base_distlimit = SEE_ALL; return SEE_ALL; @@ -1764,6 +1764,24 @@ EX int auto_compute_range(cell *c) { return ginf[geometry].distlimit[0] = cgi.base_distlimit = d; } +EX int getDistLimit() { + auto& res = cgi.base_distlimit; + if(res) return res; + if(arb::in() && arb::current.range) + return res = arb::current.range; + if(arcm::in() || arb::in()) { + if(!currentmap) return 0; + cell *c = currentmap->gamestart(); + if(!c) return 0; + return res = auto_compute_range(c); + } + if(mhybrid) + return res = hybrid::in_underlying_geometry([&] { + return max(getDistLimit()-1, 0); + }); + return ginf[geometry].distlimit[!BITRUNCATED]; + } + EX cell out_of_bounds; EX heptagon oob; diff --git a/game.cpp b/game.cpp index 808ab479..2cf8eafe 100644 --- a/game.cpp +++ b/game.cpp @@ -111,8 +111,6 @@ EX eMonster active_switch() { EX vector crush_now, crush_next; -EX int getDistLimit() { return cgi.base_distlimit; } - EX void activateFlashFrom(cell *cf, eMonster who, flagtype flags); EX bool saved_tortoise_on(cell *c) { diff --git a/geometry.cpp b/geometry.cpp index bff40dd6..839944f9 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -218,7 +218,7 @@ struct geometry_information { /** for 2D geometries */ vector heptmove, hexmove, invhexmove; - int base_distlimit; + int base_distlimit = 0; unique_ptr emb; @@ -658,7 +658,6 @@ void geometry_information::prepare_basics() { t->tessf = cgi.tessf / d; t->hexvdist = cgi.hexvdist / d; t->hexhexdist = hdist(xpush0(cgi.hcrossf), xspinpush0(TAU/S7, cgi.hcrossf)) / d; - t->base_distlimit = cgi.base_distlimit-1; }); goto hybrid_finish; } @@ -756,8 +755,6 @@ void geometry_information::prepare_basics() { (hr::format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift, hexhexdist, hexvdist))); - base_distlimit = ginf[geometry].distlimit[!BITRUNCATED]; - hybrid_finish: #if CAP_GP @@ -823,7 +820,6 @@ void geometry_information::prepare_basics() { scalefactor = csc; hcrossf = crossf = orbsize = hcrossf7 * csc; hexf = rhexf = hexvdist = csc * arb::current_or_slided().floor_scale; - base_distlimit = arb::current.range; } #if MAXMDIM >= 4