From a17445bee751f0d8fffb8d67c04d4dc3feebae49 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 6 Apr 2018 23:28:58 +0200 Subject: [PATCH] improved insightrange --- cell.cpp | 17 +++++++++++++++++ graph.cpp | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cell.cpp b/cell.cpp index 65134736..878d493b 100644 --- a/cell.cpp +++ b/cell.cpp @@ -1344,6 +1344,23 @@ cell *heptatdir(cell *c, int d) { else return createMov(c, d); } +int heptdistance(heptagon *h1, heptagon *h2) { + // very rough distance + int d = 0; + while(true) { + if(h1 == h2) return d; + for(int i=0; imove[i] == h2) return d + 1; + int d1 = h1->distance, d2 = h2->distance; + if(d1 >= d2) d++, h1 = h1->move[0]; + if(d2 >= d1) d++, h2 = h2->move[0]; + } + } + +int heptdistance(cell *c1, cell *c2) { + if(!hyperbolic || quotient) return celldistance(c1, c2); + else return heptdistance(c1->master, c2->master); + } + int celldistance(cell *c1, cell *c2) { int d = 0; diff --git a/graph.cpp b/graph.cpp index 8b01fe7f..ef567a86 100644 --- a/graph.cpp +++ b/graph.cpp @@ -5925,6 +5925,8 @@ cell *viewcenter() { } bool inscreenrange(cell *c) { - return celldistance(viewcenter(), c) <= (euclid ? get_sightrange() : nonbitrunc ? 9 : 13); + if(sphere) return true; + if(euclid) return celldistance(viewcenter(), c) <= get_sightrange(); + return heptdistance(viewcenter(), c) <= 5; }