From c5395097fe0b705877aae0e580baae7c407e7461 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 20 Aug 2018 11:59:43 +0200 Subject: [PATCH] Working Chessboard pattern. Chessboard pattern used in the Warped Coast. --- archimedean.cpp | 25 +++++-------------------- pattern2.cpp | 21 +++++++++------------ 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/archimedean.cpp b/archimedean.cpp index 3e796979..ff975615 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -18,7 +18,7 @@ struct archimedean_tiling { vector invert; vector nflags; - bool have_ph, have_line, have_symmetry, have_chessboard; + bool have_ph, have_line, have_symmetry; int repetition = 1; int N; @@ -236,23 +236,6 @@ void archimedean_tiling::prepare() { } } - if(have_symmetry) { - have_chessboard = true; - for(int o=0; o<2; o++) - for(int i=o; i<2*N; i+=2) - for(int j=i+2; j<2*N; j+=4) - if(tilegroup[i] == tilegroup[j]) - have_chessboard = false; - for(int i=0; ic7 = newCell(nei, h); h->distance = parent->distance + 1; + if(id < 2*current.N) + h->fieldval = parent->move(0)->fieldval + (d/2); return h; } @@ -663,7 +648,7 @@ int archimedean_tiling::support_graveyard() { } bool archimedean_tiling::support_chessboard() { - return 0; + return N % 2 == 0; } bool pseudohept(int id) { @@ -671,7 +656,7 @@ bool pseudohept(int id) { } bool chessvalue(cell *c) { - return current.flags[id_of(c->master)] & arcm::sfCHESS; + return c->master->fieldval & 1; } bool linespattern(cell *c) { diff --git a/pattern2.cpp b/pattern2.cpp index 465c6c9a..b633558d 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -1063,6 +1063,10 @@ namespace patterns { } +bool geosupport_chessboard() { + return archimedean ? arcm::current.support_chessboard() : (nonbitrunc && S3 == 4); + } + int geosupport_threecolor() { if(irr::on) return 0; if(!nonbitrunc && S3 == 3) { @@ -1222,12 +1226,8 @@ bool kraken_pseudohept(cell *c) { } bool warptype(cell *c) { - if(a4 && nonbitrunc) { - if(euclid) - return among(eupattern4(c), 1, 2); - else - return c->master->distance & 1; - } + if(geosupport_chessboard()) + return chessvalue(c); else if(gp::on || irr::on) return pseudohept(c); else @@ -1366,7 +1366,7 @@ namespace patterns { return (0x202020 + col[0] + (col[1] << 8) + (col[2] << 16)) >> (err?2:0); } if(whichCanvas == 'c') { - return (c->master->distance&1) ? 0xC0C0C0 : 0x202020; + return chessvalue(c) ? 0xC0C0C0 : 0x202020; } if(whichCanvas == 'F') { return pseudohept(c) ? 0x202020 : 0xC0C0C0; @@ -1393,7 +1393,7 @@ namespace patterns { } dialog::addItem(XLAT("football"), 'F'); - if(S3 == 4 && nonbitrunc) + if(geosupport_chessboard()) dialog::addItem(XLAT("chessboard"), 'c'); dialog::addItem(XLAT("nice coloring"), 'T'); @@ -1490,7 +1490,7 @@ namespace patterns { if(stdhyperbolic || euclid) dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == PAT_PALACE), PAT_PALACE); - if((nonbitrunc && S3 == 4) || (archimedean && arcm::current.support_chessboard())) + if(geosupport_chessboard()) dialog::addBoolItem(XLAT("chessboard"), (whichPattern == PAT_CHESS), PAT_CHESS); if(a38 || a46 || euclid || S3 == 4 || S7 == 4) @@ -1499,9 +1499,6 @@ namespace patterns { if(sphere) dialog::addBoolItem(XLAT("siblings"), (whichPattern == PAT_SIBLING), PAT_SIBLING); - if(archimedean) - dialog::addBoolItem(XLAT("Archimedean"), (whichPattern == PAT_SIBLING), PAT_SIBLING); - if(euclid) dialog::addBoolItem(XLAT("torus pattern"), (whichPattern == PAT_FIELD), PAT_FIELD); else if(sphere)