1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-13 00:49:54 +00:00

removed static initialization order fiasco from fieldpattern

This commit is contained in:
Zeno Rogue 2021-03-11 10:00:41 +01:00
parent b872926cac
commit 3b0c760289
2 changed files with 13 additions and 5 deletions

View File

@ -1148,7 +1148,7 @@ void fpattern::findsubpath() {
}
}
fpattern fp43(43);
fpattern *fp43;
EX void info() {
fpattern fp(0);
@ -1303,16 +1303,18 @@ EX struct fpattern& getcurrfp() {
return fp;
}
if(sphere || euclid) return fp_invalid;
if(S7 == 7 && S3 == 3 && !bt::in())
return fp43;
if(S7 == 7 && S3 == 3 && !bt::in()) {
if(!fp43) fp43 = new fpattern(43);
return *fp43;
}
return fp_invalid;
}
#undef STR
// todo undefined behavior
EX int subpathid = currfp.matcode[currfp.strtomatrix("RRRPRRRRRPRRRP")];
EX int subpathorder = currfp.order(currfp.matrices[subpathid]);
EX int subpathid = -1;
EX int subpathorder = -1;
// extra information for field quotient extra configuration

View File

@ -467,6 +467,12 @@ EX int fieldval_uniq_rand(cell *c, int randval) {
}
pair<int, int> subval(cell *c, int _subpathid = subpathid, int _subpathorder = subpathorder) {
if(_subpathid == -1)
_subpathid = currfp.matcode[currfp.strtomatrix("RRRPRRRRRPRRRP")];
if(_subpathorder == -1)
_subpathorder = currfp.order(currfp.matrices[subpathid]);
if(!ctof(c)) {
auto m = subval(createMov(c, 0));
for(int u=2; u<S6; u+=2)