diff --git a/bigstuff.cpp b/bigstuff.cpp index 11e1d390..348fdff8 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -37,6 +37,7 @@ int roundTableRadius(cell *c) { int celldistAltRelative(cell *c) { if(geometry == gCrystal) return crystal::dist_relative(c); + if(euwrap) return celldistAlt(c) - roundTableRadius(c); if(sphere || quotient) { return celldist(c) - 3; } @@ -71,6 +72,19 @@ int euclidAlt(short x, short y) { else return eudist(x-(a4 ? 21 : 20), y-10); } +int cylinder_alt(cell *c) { + if(specialland == laPrincessQuest) + return celldistance(c, vec_to_cellwalker(pair_to_vec(EPX, EPY)).at); + if(specialland == laCamelot) + return celldistance(c, vec_to_cellwalker(pair_to_vec(21, 10)).at); + + using namespace torusconfig; + int maxmul = 0; + for(int d = 0; d < SG6; d++) + maxmul = max(maxmul, dcross(sdxy(), gp::eudir(d))); + return 5-abs(gdiv(dcross(sdxy(), cell_to_pair(c)), maxmul)); + } + const int NOCOMPASS = 1000000; int compassDist(cell *c) { @@ -829,6 +843,7 @@ void setLandEuclid(cell *c) { int x, y; tie(x,y) = cell_to_pair(c); y += 10; + if(euwrap) y = -celldistAlt(c); if(y == 0) { setland(c, laBarrier); if(ishept(c)) c->land = laRlyeh; } else if(y<0) setland(c, laRlyeh); @@ -838,6 +853,7 @@ void setLandEuclid(cell *c) { int x, y; tie(x,y) = cell_to_pair(c); y = -5 - y; if(specialland == laDungeon) y = -10 - y; + if(euwrap) y = -celldistAlt(c); if(y == 0) {setland(c, laBarrier); if(ishept(c)) setland(c, laAlchemist); } else if(y<0) setland(c, laAlchemist); @@ -1239,6 +1255,10 @@ void buildCamelot(cell *c) { void moreBigStuff(cell *c) { + if((bearsCamelot(c->land) && !euclid && !quotient) || c->land == laCamelot) + if(eubinary || binarytiling || c->master->alt) if(!(binarytiling && specialland != laCamelot)) + buildCamelot(c); + if(quotient) return; if(c->land == laPalace && !eubinary && c->master->alt) { @@ -1267,10 +1287,6 @@ void moreBigStuff(cell *c) { } } - if((bearsCamelot(c->land) && !euclid && !quotient) || c->land == laCamelot) - if(eubinary || binarytiling || c->master->alt) if(!(binarytiling && specialland != laCamelot)) - buildCamelot(c); - if(chaosmode && c->land == laTemple) { for(int i=0; itype; i++) if(pseudohept(c) && c->move(i) && c->move(i)->land != laTemple) diff --git a/cell.cpp b/cell.cpp index de7aeb29..79c71b30 100644 --- a/cell.cpp +++ b/cell.cpp @@ -357,6 +357,10 @@ namespace torusconfig { return 2 * (e1.first * e2.first + e1.second*e2.second) + (S3 == 3 ? e1.first*e2.second + e2.first * e1.second : 0); } + int dcross(gp::loc e1, gp::loc e2) { + return e1.first * e2.second - e1.second*e2.first; + } + gp::loc sdxy() { return gp::loc(sdx, sdy); } int mobius_dir_basic() { @@ -1356,6 +1360,7 @@ int celldist(cell *c) { int celldistAlt(cell *c) { if(masterless) { if(fulltorus) return celldist(c); + if(euwrap) return cylinder_alt(c); int x, y; tie(x,y) = vec_to_pair(decodeId(c->master)); return euclidAlt(x, y); diff --git a/hyper.h b/hyper.h index f67ad236..d76f3e16 100644 --- a/hyper.h +++ b/hyper.h @@ -4500,6 +4500,7 @@ namespace ts { void generate_around(cell *c); int euclidAlt(short x, short y); +int cylinder_alt(cell *c); struct exp_parser { string s;