1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

torus3 improvements

This commit is contained in:
Zeno Rogue 2019-11-02 22:17:57 +01:00
parent e8de4d088c
commit 377fd3f8bd
2 changed files with 7 additions and 6 deletions

View File

@ -435,7 +435,7 @@ EX int celldist(cell *c) {
if(fulltorus && WDIM == 2)
return get_torus_dist(decodeId(c->master));
if(nil) return DISTANCE_UNKNOWN;
if(euwrap)
if(euwrap && WDIM == 2)
return torusconfig::cyldist(decodeId(c->master), 0);
if(masterless)
return eudist(decodeId(c->master));

View File

@ -846,7 +846,7 @@ EX namespace euclid3 {
EX int celldistance(cell *c1, cell *c2) {
auto cm = cubemap();
return celldistance(cm->ispacemap[c1->master] - cm->ispacemap[c2->master]);
return celldistance(canonicalize(cm->ispacemap[c1->master] - cm->ispacemap[c2->master]));
}
EX void set_land(cell *c) {
@ -913,16 +913,17 @@ EX namespace euclid3 {
int coords;
int twisted0, twisted_edit;
EX void clear_torus3() {
for(int i=0; i<3; i++) user_axes[i] = 0;
}
EX void set_torus3(int x, int y, int z) {
for(int i=0; i<3; i++) for(int j=0; j<3; j++) T0[i][j] = 0;
tie(T0[0][0], T0[1][1], T0[2][2]) = make_tuple(x, y, z);
twisted = 0;
build_torus3();
}
EX void clear_torus3() {
set_torus3(0, 0, 0);
}
unordered_map<coord, int> canonical_hash;
vector<coord> canonical_seq;
int canonical_index;