diff --git a/cell.cpp b/cell.cpp index 9ca25b45..20ffbe7a 100644 --- a/cell.cpp +++ b/cell.cpp @@ -1361,6 +1361,8 @@ int heptdistance(cell *c1, cell *c2) { else return heptdistance(c1->master, c2->master); } +map, int> saved_distances; + int celldistance(cell *c1, cell *c2) { int d = 0; @@ -1371,9 +1373,26 @@ int celldistance(cell *c1, cell *c2) { } if(sphere || quotient == 1 || gp::on) { + + if(saved_distances.count(make_pair(c1,c2))) + return saved_distances[make_pair(c1,c2)]; + + celllister cl(c1, 64, 1000, c2); + for(int i=0; i