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

smart celldistance did not work with non-standard tori -- replacing with a dumb one for now

This commit is contained in:
Zeno Rogue 2018-06-17 18:14:33 +02:00
parent 35301f0a68
commit b2cc825ec9

View File

@ -1362,16 +1362,17 @@ map<pair<cell*, cell*>, int> saved_distances;
int celldistance(cell *c1, cell *c2) { int celldistance(cell *c1, cell *c2) {
int d = 0; int d = 0;
if(euclid) { if(euclid6) {
if(torus) if(!torus)
return torusmap()->dists[torusconfig::vec_to_id(decodeId(c1->master)-decodeId(c2->master))];
return eudist(decodeId(c1->master) - decodeId(c2->master)); return eudist(decodeId(c1->master) - decodeId(c2->master));
else if(torus && torusconfig::torus_mode == 0)
return torusmap()->dists[torusconfig::vec_to_id(decodeId(c1->master)-decodeId(c2->master))];
} }
if(quotient == 2 && !gp::on) if(quotient == 2 && !gp::on)
return currfp.getdist(fieldpattern::fieldval(c1), fieldpattern::fieldval(c2)); return currfp.getdist(fieldpattern::fieldval(c1), fieldpattern::fieldval(c2));
if(sphere || quotient) { if(sphere || quotient || torus) {
if(saved_distances.count(make_pair(c1,c2))) if(saved_distances.count(make_pair(c1,c2)))
return saved_distances[make_pair(c1,c2)]; return saved_distances[make_pair(c1,c2)];