1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

improved insightrange

This commit is contained in:
Zeno Rogue 2018-04-06 23:28:58 +02:00
parent 63f50a1136
commit a17445bee7
2 changed files with 20 additions and 1 deletions

View File

@ -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; i<S7; i++) if(h1->move[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;

View File

@ -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;
}