added MAXMDIM guards

This commit is contained in:
Zeno Rogue 2020-01-29 18:18:51 +01:00
parent 3500d67af6
commit f05fa60400
6 changed files with 44 additions and 5 deletions

View File

@ -138,7 +138,9 @@ EX int default_levs() {
return 1;
if(S3 >= OINF)
return 1;
#if MAXMDIM >= 4
if(reg3::in_rule()) return 0;
#endif
return S3-3;
}
@ -152,7 +154,10 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
for(int i=0; i<h->type; i++)
createStep(h->alt, i)->alt = h->alt->alt;
int relspin = -4; // for horocycles it must go the other way
if(quotient || reg3::in_rule()) relspin = 0;
if(quotient) relspin = 0;
#if MAXMDIM >= 4
else if(reg3::in_rule()) relspin = 0;
#endif
else {
for(int j=0; j<h->type; j++) for(int i=0; i<h->type; i++) {
createStep(h, i);
@ -194,11 +199,13 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
}
}
#if MAXMDIM >= 4
EX int hrandom_adjacent(int d) {
vector<int> choices = {d};
for(int a=0; a<S7; a++) if(reg3::dirs_adjacent[d][a]) choices.push_back(a);
return hrand_elt(choices, d);
}
#endif
EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) {
@ -211,7 +218,11 @@ EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special
// check for direction
int gdir = -1;
for(int i=0; i<c->type; i++) {
#if MAXMDIM >= 4
if(!reg3::in_rule()) {
#else
if(true) {
#endif
if(c->move(i) && c->move(i)->mpdist < c->mpdist) gdir = i;
}
else {
@ -283,10 +294,12 @@ EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special
if(hybri) alt->fieldval = hybrid::get_where(centerover).second;
alt->c7 = NULL;
alt->alt = alt;
#if MAXMDIM >= 4
if(reg3::in_rule()) {
reg3::link_structures(h, alt, firststate);
if(alt->fiftyval == -1) return nullptr; /* unlinked */
}
#endif
h->alt = alt;
alt->cdata = (cdata*) h;
currentmap->link_alt(bf);
@ -1499,7 +1512,10 @@ EX void buildBigStuff(cell *c, cell *from) {
buildBarrier4(c, bd, 0, getNewLand(c->land), c->land); */
}
if((!chaosmode) && bearsCamelot(c->land) && is_master(c) && !bt::in() && !(hyperbolic && WDIM == 3 && !reg3::in_rule()) &&
if((!chaosmode) && bearsCamelot(c->land) && is_master(c) && !bt::in() &&
#if MAXMDIM >= 4
!(hyperbolic && WDIM == 3 && !reg3::in_rule()) &&
#endif
(quickfind(laCamelot) || peace::on || (hrand(I2000) < (c->land == laCrossroads4 ? 800 : 200) && horo_ok() &&
items[itEmerald] >= U5 && !tactic::on && !racing::on))) {
int rtr = newRoundTableRadius();

View File

@ -148,8 +148,10 @@ EX hrmap *currentmap;
EX vector<hrmap*> allmaps;
EX hrmap *newAltMap(heptagon *o) {
#if MAXMDIM >= 4
if(reg3::in_rule())
return reg3::new_alt_map(o);
#endif
return new hrmap_hyperbolic(o);
}
// --- hyperbolic geometry ---
@ -524,11 +526,13 @@ EX int celldistAlt(cell *c) {
/** direction upwards in the tree */
EX int updir(heptagon *h) {
if(bt::in()) return bt::updir();
#if MAXMDIM >= 4
if(WDIM == 3 && reg3::in_rule()) {
for(int i=0; i<S7; i++) if(h->move(i) && h->move(i)->distance < h->distance)
return i;
return -1;
}
#endif
if(h->distance == 0) return -1;
return 0;
}
@ -536,11 +540,13 @@ EX int updir(heptagon *h) {
/** direction upwards in the alt-tree */
EX int updir_alt(heptagon *h) {
if(euclid || !h->alt) return -1;
#if MAXMDIM >= 4
if(WDIM == 3 && reg3::in_rule()) {
for(int i=0; i<S7; i++) if(h->move(i) && h->move(i)->alt && h->move(i)->alt->distance < h->alt->distance)
return i;
return -1;
}
#endif
for(int i=0; i<S7; i++)
if(h->move(i) && h->move(i)->alt == h->alt->move(0))
return i;

View File

@ -872,10 +872,12 @@ void celldrawer::draw_halfvine() {
queuepolyat(GDIM == 2 ? Vdepth : V2, cgi.shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR::WALL3A);
{dynamicval<color_t> p(poly_outline, OUTLINE_TRANS); queuepolyat(V2 * spin(M_PI*2/3), cgi.shSemiFloorShadow, SHADOW_WALL, GDIM == 2 ? PPR::WALLSHADOW : PPR::TRANSPARENT_SHADOW); }
auto& side = queuepolyat(V2, cgi.shSemiFloorSide[SIDE_WALL], darkena(vcol, fd, 0xFF), PPR::WALL3A-2+away(V2));
#if MAXMDIM >= 4
if(GDIM == 3 && qfi.fshape) {
side.tinf = &floor_texture_vertices[shar.id];
ensure_vertex_number(*side.tinf, side.cnt);
}
#endif
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, j, c) {
int dis = i-j;
@ -1529,6 +1531,7 @@ void celldrawer::draw_features() {
}
void celldrawer::draw_features_and_walls_3d() {
#if MAXMDIM >= 4
color_t dummy;
int ofs = wall_offset(c);
if(isWall3(c, wcol)) {
@ -1645,6 +1648,7 @@ void celldrawer::draw_features_and_walls_3d() {
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x804060, 0, 0xFF));
if(rd == 2)
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x402030, 0, 0xFF));
#endif
}
#if HDR

View File

@ -299,6 +299,9 @@ struct fpattern {
unsigned compute_hash();
void set_field(int p, int sq);
#if MAXMDIM >= 4
// general 4D
vector<transmatrix> fullv;
@ -308,12 +311,10 @@ struct fpattern {
int solve3();
bool generate_all3();
void set_field(int p, int sq);
// transmatrix full_R, full_P, full_X;
#if CAP_THREAD
struct discovery *dis;
#endif
#endif
};
#if CAP_THREAD
@ -377,6 +378,7 @@ vector<matrix> fpattern::generate_isometries() {
return res;
}
#if MAXMDIM >= 4
vector<matrix> fpattern::generate_isometries3() {
matrix T = Id;
@ -454,6 +456,7 @@ void fpattern::add1(const matrix& M, const transmatrix& Full) {
matcode[M] = i, matrices.push_back(M), fullv.push_back(Full);
}
}
#endif
map<unsigned,int> hash_found;
@ -469,6 +472,7 @@ unsigned fpattern::compute_hash() {
return hashv;
}
#if MAXMDIM >= 4
bool fpattern::generate_all3() {
reg3::generate_fulls();
@ -554,6 +558,7 @@ int fpattern::solve3() {
return cmb;
}
#endif
void fpattern::set_field(int p, int sq) {
Prime = p;
@ -586,6 +591,7 @@ int fpattern::solve() {
}
} else wsquare = 0;
#if MAXMDIM >= 4
if(WDIM == 3) {
if(dual == 0 && (Prime <= limitsq || pw == 1)) {
int s = solve3();
@ -593,6 +599,7 @@ int fpattern::solve() {
}
continue;
}
#endif
if(dual == 2) {
if(Field <= 10) {
@ -1325,7 +1332,9 @@ EX void hread_fpattern(hstream& hs, fieldpattern::fpattern& fp) {
hread(hs, fp.R);
hread(hs, fp.X);
fp.set_field(fp.Prime, fp.wsquare);
#if MAXMDIM >= 4
fp.generate_all3();
#endif
}
EX void hwrite_fpattern(hstream& hs, fieldpattern::fpattern& fp) {

View File

@ -3603,12 +3603,14 @@ EX bool fat_edges = false;
EX void gridline(const transmatrix& V1, const hyperpoint h1, const transmatrix& V2, const hyperpoint h2, color_t col, int prec) {
ld d = hdist(V1*h1, V2*h2);
#if MAXMDIM >= 4
if(WDIM == 3 && fat_edges) {
transmatrix T = V1 * rgpushxto0(h1);
transmatrix S = rspintox(inverse(T) * V2 * h2);
queuepoly(T * S, cgi.generate_pipe(d, vid.linewidth), col);
return;
}
#endif
while(d > precise_width && d < 100 && grid_depth < 10) {
if(!eqmatrix(V1, V2, 1e-6)) { gridline(V1, h1, V1, inverse(V1) * V2 * h2, col, prec); return; }

View File

@ -667,6 +667,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
#endif
else if(arb::in() && arb::current.have_line)
c->wall = arb::linespattern(c) ? waTrapdoor : waNone;
#if MAXMDIM >= 4
else if(reg3::in_rule()) switch(geometry) {
case gSpace534: {
if(c->master->fieldval == 0) c->wall = waTrapdoor;
@ -690,6 +691,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
}
default: ;
}
#endif
else if(euclid && !arcm::in()) {
auto co = euc2_coordinates(c);
int y = co.second;