From 39db828a38874400330f28b59fea94cd349b67a3 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 9 May 2018 21:32:31 +0200 Subject: [PATCH] Fixed the bugs with computing fieldpattern not in hyperbolic geometry (memory error + canvas crashes) --- bigstuff.cpp | 2 +- complex.cpp | 2 +- fieldpattern.cpp | 10 ++++++++-- graph.cpp | 2 +- pattern2.cpp | 8 ++++---- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index 38702ff5..b2636237 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -1064,7 +1064,7 @@ void buildBigStuff(cell *c, cell *from) { else if(c->land == laCrossroads2 && !nonbitrunc) buildCrossroads2(c); - else if(c->land == laPrairie && c->LHU.fi.walldist == 0) { + else if(c->land == laPrairie && c->LHU.fi.walldist == 0 && !euclid) { for(int bd=0; bd<7; bd++) { int fval2 = createStep(c->master, bd)->fieldval; int wd = currfp_gmul(fval2, currfp_inverses(c->fval-1)); diff --git a/complex.cpp b/complex.cpp index 2fe5aa8b..7a02ed37 100644 --- a/complex.cpp +++ b/complex.cpp @@ -3087,7 +3087,7 @@ namespace windmap { if(N == 18920) precomp = windcodes18920; if(N == 5676) precomp = windcodes5676; - if(precomp && size(currfp.matrices)) { + if(precomp && hyperbolic && size(currfp.matrices)) { int randval = hrand(size(currfp.matrices)); for(int i=0; i fgeomextras = { fgeomextra(gOctagon, 1), fgeomextra(g45, 0), fgeomextra(g46, 3), - fgeomextra(g47, 0) + fgeomextra(g47, 0), +/* fgeomextra(gSphere, 0), + fgeomextra(gSmallSphere, 0), -> does not find the prime + fgeomextra(gEuclid, 0), + fgeomextra(gEuclidSquare, 0), + fgeomextra(gTinySphere, 0) */ }; int current_extra = 0; diff --git a/graph.cpp b/graph.cpp index 263bec96..b2345509 100644 --- a/graph.cpp +++ b/graph.cpp @@ -5728,7 +5728,7 @@ auto graphcm = addHook(clearmemory, 0, [] () { void resetGeometry() { precalc(); - currfp.analyze(); + if(hyperbolic) currfp.analyze(); #if CAP_GL resetGL(); #endif diff --git a/pattern2.cpp b/pattern2.cpp index d3da29c5..a6b6469d 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -1120,7 +1120,7 @@ namespace patterns { char whichCanvas = 0; int generateCanvas(cell *c) { - if(whichCanvas == 'C' && !torus) { + if(whichCanvas == 'C' && hyperbolic) { using namespace fieldpattern; int z = currfp.getdist(fieldval(c), make_pair(0,false)); if(z < currfp.circrad) return 0x00C000; @@ -1129,12 +1129,12 @@ namespace patterns { return 0x3000; return 0x6000; } - if(whichCanvas == 'D' && !torus) { + if(whichCanvas == 'D' && hyperbolic) { using namespace fieldpattern; int z = currfp.getdist(fieldval(c), make_pair(0,false)); return 255 * (currfp.maxdist+1-z) / currfp.maxdist; } - if(whichCanvas == 'N' && !torus) { + if(whichCanvas == 'N' && hyperbolic) { using namespace fieldpattern; int z = currfp.getdist(fieldval(c), make_pair(0,false)); int z2 = currfp.getdist(fieldval(c), make_pair(currfp.otherpole,false)); @@ -1146,7 +1146,7 @@ namespace patterns { int cd = celldist(c); return gradient(0, canvasback, 0, min(1.8/(1+cd), 1.), 1); } - if(whichCanvas == 'S' && !torus) { + if(whichCanvas == 'S' && hyperbolic) { return 0x3F1F0F * fieldpattern::subval(c).second + 0x000080; } if(whichCanvas == 'g')