mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
asonov:: substraction op used for efficient celldistance
This commit is contained in:
parent
c4a4bb7f48
commit
577ab0e1d4
9
cell.cpp
9
cell.cpp
@ -1040,10 +1040,17 @@ EX int celldistance(cell *c1, cell *c2) {
|
||||
|
||||
if(bounded) {
|
||||
|
||||
int limit = 6000;
|
||||
if(asonov::in()) {
|
||||
c2 = asonov::get_at(asonov::get_coord(c2->master) - asonov::get_coord(c1->master))->c7;
|
||||
c1 = currentmap->gamestart();
|
||||
limit = 100000000;
|
||||
}
|
||||
|
||||
if(saved_distances.count(make_pair(c1,c2)))
|
||||
return saved_distances[make_pair(c1,c2)];
|
||||
|
||||
celllister cl(c1, 100, 100000000, NULL);
|
||||
celllister cl(c1, 100, limit, NULL);
|
||||
for(int i=0; i<isize(cl.lst); i++)
|
||||
saved_distances[make_pair(c1, cl.lst[i])] = cl.dists[i];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user