From 80e0ad5cd0c05f2bbadf6695ee0fba76f54a8c34 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 30 Aug 2018 16:08:05 +0200 Subject: [PATCH] fixed some lands in Archimedean dual --- bigstuff.cpp | 10 ++++++++++ complex.cpp | 1 + graph.cpp | 18 ++++++++++++------ hyper.h | 4 ++-- landgen.cpp | 19 +++++++++++-------- landlock.cpp | 11 ++++++++++- 6 files changed, 46 insertions(+), 17 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index c38fb9c7..360e4ba0 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -453,7 +453,17 @@ bool checkInTree(cell *c, int maxv) { return false; } +int loopval = 0; + +struct loopchecker { + loopchecker() { loopval++; } + ~loopchecker() { loopval--; } + }; + void buildEquidistant(cell *c) { + loopchecker lc; + // sometimes crashes in Archimedean + if(loopval > 100) { c->landparam = 0; return; } if(!c) return; if(c->landparam) return; /* if(weirdhyperbolic) { diff --git a/complex.cpp b/complex.cpp index 5f8097ca..c72c9c5c 100644 --- a/complex.cpp +++ b/complex.cpp @@ -10,6 +10,7 @@ namespace hr { namespace whirlwind { int fzebra3(cell *c) { + if(archimedean) return 0; if(euclid) { if(torus) return 0; int x, y; diff --git a/graph.cpp b/graph.cpp index cf7035db..5d75babc 100644 --- a/graph.cpp +++ b/graph.cpp @@ -2611,13 +2611,19 @@ bool drawstaratvec(double dx, double dy) { } int reptilecolor(cell *c) { - int i = zebra40(c); + int i; - if(!masterless) { - if(i >= 4 && i < 16) i = 0; - else if(i >= 16 && i < 28) i = 1; - else if(i >= 28 && i < 40) i = 2; - else i = 3; + if(archimedean) + i = c->master->rval0 & 3; + else { + int i = zebra40(c); + + if(!masterless) { + if(i >= 4 && i < 16) i = 0; + else if(i >= 16 && i < 28) i = 1; + else if(i >= 28 && i < 40) i = 2; + else i = 3; + } } int fcoltab[4] = {0xe3bb97, 0xc2d1b0, 0xebe5cb, 0xA0A0A0}; diff --git a/hyper.h b/hyper.h index 57efdded..74db8237 100644 --- a/hyper.h +++ b/hyper.h @@ -82,8 +82,8 @@ void addMessage(string s, char spamtype = 0); #define ALPHA (M_PI*2/S7) #define S7 ginf[geometry].sides #define S3 ginf[geometry].vertex -#define hyperbolic_37 (S7 == 7 && S3 == 3 && !binarytiling) -#define hyperbolic_not37 ((S7 > 7 || S3 > 3 || binarytiling) && hyperbolic) +#define hyperbolic_37 (S7 == 7 && S3 == 3 && !binarytiling && !archimedean) +#define hyperbolic_not37 ((S7 > 7 || S3 > 3 || binarytiling || archimedean) && hyperbolic) #define weirdhyperbolic ((S7 > 7 || S3 > 3 || !STDVAR || binarytiling || archimedean) && hyperbolic) #define stdhyperbolic (S7 == 7 && S3 == 3 && STDVAR && !binarytiling && !archimedean) diff --git a/landgen.cpp b/landgen.cpp index 9c39c849..ba825940 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -190,7 +190,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { case laPalace: // ------------------------------------------------------------- - if(hyperbolic_not37 || torus || S7 < 5) { + if(hyperbolic_not37 || torus || S7 < 5 || archimedean) { if(d == 9) { int i = hrand(100); if(i < 10) @@ -210,7 +210,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { else { if(d == 9) { - cell *c2 = (GOLDBERG || IRREGULAR) ? c->master->c7 : c; + cell *c2 = NONSTDVAR ? c->master->c7 : c; if(cdist50(c2) == 3 && polarb50(c2) == 1) c->wall = waPalace; } @@ -405,7 +405,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { c->wall = waCavewall; else c->wall = waCavefloor; } - else if(a4) + else if(a4 || archimedean) c->wall = hrand(100) < 50 ? waCavefloor : waCavewall; else if(!BITRUNCATED) { if(polarb50(c)) @@ -550,8 +550,10 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(y&1) c->wall = waTrapdoor; else c->wall = waNone; } + else + if(archimedean) c->wall = hrand(2) ? waTrapdoor : waNone; else - c->wall = (randomPatternsMode ? RANDPAT : (zebra40(c)&2)) ? waTrapdoor : waNone; + c->wall = (randomPatternsMode ? RANDPAT : (zebra40(c)&2)) ? waTrapdoor : waNone; } ONEMPTY { if(c->wall == waNone && hrand(2500) < PT(100 + 2 * (kills[moOrangeDog]), 300) && notDippingFor(itZebra)) @@ -617,9 +619,9 @@ void giantLandSwitch(cell *c, int d, cell *from) { c->item = itDodeca; } else { - int i = zebra40(c); + int i = archimedean ? hrand(50) : zebra40(c); if(i < 40) { - int cd = getCdata(c, 3); + int cd = hyperbolic_37 ? getCdata(c, 3) : hrand(16); cd &= 15; if(cd >= 4 && cd < 12) c->wall = waChasm; else { @@ -1109,7 +1111,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(d == 9) { if(randomPatternsMode) c->wall = RANDPAT ? waNone : waSaloon; - else if(cdist50(c) <= 2) c->wall = waSaloon; + else if(hyperbolic_37 ? cdist50(c) <= 2 : hrand(100) < 20) c->wall = waSaloon; } ONEMPTY { if(hrand(25000) < 2 + (2 * items[itBounty] + yendor::hardness()) + (items[itRevolver] ? 150:0)) @@ -1129,6 +1131,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(S7 == 4 && celldistance(c, currentmap->gamestart()) == 2 && ctof(c)) c->wall = waChasm; } + else if(archimedean) ; else if(!euclid && zebra3(c) == 0) c->wall = waFan; else if(pseudohept(c) && hrand(2000) < 150 && !reptilecheat) c->wall = waChasm; @@ -2116,7 +2119,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(a38) patterns::val38(c, si, patterns::SPF_DOCKS, patterns::PAT_COLORING); else - si.id = (zebra40(c)&2) ? 0 : zebra40(c) == 4 ? 8 : 1; + si.id = archimedean ? (hrand(6)*4) : (zebra40(c)&2) ? 0 : zebra40(c) == 4 ? 8 : 1; c->wall = waSea; if(among(si.id, 0, 4, 16, PURE ? -1 : 24)) c->wall = waDock; diff --git a/landlock.cpp b/landlock.cpp index d3b5f856..97a9181c 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -1189,15 +1189,23 @@ land_validity_t& land_validity(eLand l) { if(IRREGULAR && among(l, laPrairie, laMirror, laMirrorOld)) return dont_work; + + if(archimedean && l == laPrairie) return dont_work; - if(IRREGULAR && among(laBlizzard, laVolcano) && !sphere) + if((IRREGULAR || archimedean) && among(l, laBlizzard, laVolcano) && !sphere) return dont_work; + if(archimedean && DUAL && l == laCrossroads4) + return not_implemented; + // equidistant-based lands if(isEquidLand(l)) { // no equidistants supported in chaos mode if(chaosmode) return not_in_chaos; + // the algorithm fails in Archimedean DUAL + if(archimedean && DUAL) + return not_implemented; // no equidistants supported in these geometries (big sphere is OK though) if(quotient || elliptic || smallsphere || torus) return unbounded_only_except_bigsphere; @@ -1245,6 +1253,7 @@ land_validity_t& land_validity(eLand l) { return special_chaos; return not_in_chaos; } + if(archimedean) return not_implemented; if(bounded) return unbounded_only; }