mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
Fixed the bugs with computing fieldpattern not in hyperbolic geometry (memory error + canvas crashes)
This commit is contained in:
parent
03db677d66
commit
39db828a38
@ -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));
|
||||
|
@ -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<N; i++)
|
||||
windcodes[i] = precomp[getid[fieldpattern::fieldval_uniq_rand(samples[i], randval)]-1];
|
||||
|
@ -697,7 +697,7 @@ void info() {
|
||||
printf("cases found = %d (%d hard)\n", cases, hard);
|
||||
}
|
||||
|
||||
fpattern current_quotient_field(0);
|
||||
fpattern current_quotient_field(0), fp_invalid(0);
|
||||
bool quotient_field_changed;
|
||||
|
||||
fpattern& getcurrfp() {
|
||||
@ -719,6 +719,7 @@ fpattern& getcurrfp() {
|
||||
static fpattern fp(13);
|
||||
return fp;
|
||||
}
|
||||
if(sphere || euclid) return fp_invalid;
|
||||
return fp43;
|
||||
}
|
||||
|
||||
@ -729,7 +730,12 @@ vector<fgeomextra> 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;
|
||||
|
@ -5728,7 +5728,7 @@ auto graphcm = addHook(clearmemory, 0, [] () {
|
||||
|
||||
void resetGeometry() {
|
||||
precalc();
|
||||
currfp.analyze();
|
||||
if(hyperbolic) currfp.analyze();
|
||||
#if CAP_GL
|
||||
resetGL();
|
||||
#endif
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user