1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-20 11:54:48 +00:00

separated bounded_distance and clueless_distance into functions

This commit is contained in:
Zeno Rogue 2020-01-28 10:21:27 +01:00
parent 4287ddf883
commit 570272fd7a

View File

@ -984,17 +984,7 @@ EX cell *random_in_distance(cell *c, int d) {
return choices[hrand(isize(choices))];
}
EX int celldistance(cell *c1, cell *c2) {
if(hybri) return hybrid::celldistance(c1, c2);
#if CAP_FIELD
if(geometry == gFieldQuotient && !GOLDBERG)
return currfp.getdist(fieldpattern::fieldval(c1), fieldpattern::fieldval(c2));
#endif
if(bounded) {
EX int bounded_celldistance(cell *c1, cell *c2) {
int limit = 6000;
if(asonov::in()) {
c2 = asonov::get_at(asonov::get_coord(c2->master) - asonov::get_coord(c1->master))->c7;
@ -1015,16 +1005,7 @@ EX int celldistance(cell *c1, cell *c2) {
return DISTANCE_UNKNOWN;
}
#if CAP_CRYSTAL
if(cryst) return crystal::precise_distance(c1, c2);
#endif
if(euc::in() && WDIM == 2) {
return euc::cyldist(euc2_coordinates(c1), euc2_coordinates(c2));
}
if(arcm::in() || quotient || sn::in() || (kite::in() && euclid) || experimental || sl2 || nil) {
EX int clueless_celldistance(cell *c1, cell *c2) {
if(saved_distances.count(make_pair(c1,c2)))
return saved_distances[make_pair(c1,c2)];
@ -1041,6 +1022,28 @@ EX int celldistance(cell *c1, cell *c2) {
return DISTANCE_UNKNOWN;
}
EX int celldistance(cell *c1, cell *c2) {
if(hybri) return hybrid::celldistance(c1, c2);
#if CAP_FIELD
if(geometry == gFieldQuotient && !GOLDBERG)
return currfp.getdist(fieldpattern::fieldval(c1), fieldpattern::fieldval(c2));
#endif
if(bounded) return bounded_celldistance(c1, c2);
#if CAP_CRYSTAL
if(cryst) return crystal::precise_distance(c1, c2);
#endif
if(euc::in() && WDIM == 2) {
return euc::cyldist(euc2_coordinates(c1), euc2_coordinates(c2));
}
if(arcm::in() || quotient || sn::in() || (kite::in() && euclid) || experimental || sl2 || nil)
return clueless_celldistance(c1, c2);
if(S3 >= OINF) return inforder::celldistance(c1, c2);
#if CAP_BT && MAXMDIM >= 4