mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-25 19:07:40 +00:00
separated bounded_distance and clueless_distance into functions
This commit is contained in:
45
cell.cpp
45
cell.cpp
@@ -984,17 +984,7 @@ EX cell *random_in_distance(cell *c, int d) {
|
|||||||
return choices[hrand(isize(choices))];
|
return choices[hrand(isize(choices))];
|
||||||
}
|
}
|
||||||
|
|
||||||
EX int celldistance(cell *c1, cell *c2) {
|
EX int bounded_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) {
|
|
||||||
|
|
||||||
int limit = 6000;
|
int limit = 6000;
|
||||||
if(asonov::in()) {
|
if(asonov::in()) {
|
||||||
c2 = asonov::get_at(asonov::get_coord(c2->master) - asonov::get_coord(c1->master))->c7;
|
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;
|
return DISTANCE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CAP_CRYSTAL
|
EX int clueless_celldistance(cell *c1, cell *c2) {
|
||||||
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) {
|
|
||||||
|
|
||||||
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)];
|
||||||
|
|
||||||
@@ -1041,6 +1022,28 @@ EX int celldistance(cell *c1, cell *c2) {
|
|||||||
return DISTANCE_UNKNOWN;
|
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(S3 >= OINF) return inforder::celldistance(c1, c2);
|
||||||
|
|
||||||
#if CAP_BT && MAXMDIM >= 4
|
#if CAP_BT && MAXMDIM >= 4
|
||||||
|
|||||||
Reference in New Issue
Block a user