mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 15:36:59 +00:00
fixed distance computation in 3D fieldquotient
This commit is contained in:
parent
7096d152be
commit
e70915de9d
6
cell.cpp
6
cell.cpp
@ -1064,8 +1064,10 @@ 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));
|
||||
if(geometry == gFieldQuotient) {
|
||||
int d = fieldpattern::field_celldistance(c1, c2);
|
||||
if(d != DISTANCE_UNKNOWN) return d;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(bounded) return bounded_celldistance(c1, c2);
|
||||
|
@ -1313,6 +1313,15 @@ int hk =
|
||||
|
||||
EX purehookset on_geometry_change;
|
||||
|
||||
EX int field_celldistance(cell *c1, cell *c2) {
|
||||
if(geometry != gFieldQuotient) return DISTANCE_UNKNOWN;
|
||||
if(GOLDBERG) return DISTANCE_UNKNOWN;
|
||||
auto v1 =fieldpattern::fieldval(c1);
|
||||
auto v2 =fieldpattern::fieldval(c2);
|
||||
int d = currfp.getdist(v1, v2);
|
||||
return d;
|
||||
}
|
||||
|
||||
EX }
|
||||
|
||||
#define currfp fieldpattern::getcurrfp()
|
||||
|
@ -366,7 +366,7 @@ EX int zebra3(cell *c) {
|
||||
EX namespace fieldpattern {
|
||||
|
||||
EX pair<int, bool> fieldval(cell *c) {
|
||||
if(WDIM == 3) return make_pair(int(c->master->fieldval) * currfp.local_group, false);
|
||||
if(WDIM == 3) return make_pair(currfp.inverses[int(c->master->fieldval) * currfp.local_group], false);
|
||||
else if(ctof(c)) return make_pair(int(c->master->fieldval), false);
|
||||
else return make_pair(btspin(c->master->fieldval, c->c.spin(0)), true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user