added MAXMDIM guards
This commit is contained in:
parent
3500d67af6
commit
f05fa60400
20
bigstuff.cpp
20
bigstuff.cpp
|
@ -138,7 +138,9 @@ EX int default_levs() {
|
||||||
return 1;
|
return 1;
|
||||||
if(S3 >= OINF)
|
if(S3 >= OINF)
|
||||||
return 1;
|
return 1;
|
||||||
|
#if MAXMDIM >= 4
|
||||||
if(reg3::in_rule()) return 0;
|
if(reg3::in_rule()) return 0;
|
||||||
|
#endif
|
||||||
return S3-3;
|
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++)
|
for(int i=0; i<h->type; i++)
|
||||||
createStep(h->alt, i)->alt = h->alt->alt;
|
createStep(h->alt, i)->alt = h->alt->alt;
|
||||||
int relspin = -4; // for horocycles it must go the other way
|
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 {
|
else {
|
||||||
for(int j=0; j<h->type; j++) for(int i=0; i<h->type; i++) {
|
for(int j=0; j<h->type; j++) for(int i=0; i<h->type; i++) {
|
||||||
createStep(h, 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) {
|
EX int hrandom_adjacent(int d) {
|
||||||
vector<int> choices = {d};
|
vector<int> choices = {d};
|
||||||
for(int a=0; a<S7; a++) if(reg3::dirs_adjacent[d][a]) choices.push_back(a);
|
for(int a=0; a<S7; a++) if(reg3::dirs_adjacent[d][a]) choices.push_back(a);
|
||||||
return hrand_elt(choices, d);
|
return hrand_elt(choices, d);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) {
|
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
|
// check for direction
|
||||||
int gdir = -1;
|
int gdir = -1;
|
||||||
for(int i=0; i<c->type; i++) {
|
for(int i=0; i<c->type; i++) {
|
||||||
|
#if MAXMDIM >= 4
|
||||||
if(!reg3::in_rule()) {
|
if(!reg3::in_rule()) {
|
||||||
|
#else
|
||||||
|
if(true) {
|
||||||
|
#endif
|
||||||
if(c->move(i) && c->move(i)->mpdist < c->mpdist) gdir = i;
|
if(c->move(i) && c->move(i)->mpdist < c->mpdist) gdir = i;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
if(hybri) alt->fieldval = hybrid::get_where(centerover).second;
|
||||||
alt->c7 = NULL;
|
alt->c7 = NULL;
|
||||||
alt->alt = alt;
|
alt->alt = alt;
|
||||||
|
#if MAXMDIM >= 4
|
||||||
if(reg3::in_rule()) {
|
if(reg3::in_rule()) {
|
||||||
reg3::link_structures(h, alt, firststate);
|
reg3::link_structures(h, alt, firststate);
|
||||||
if(alt->fiftyval == -1) return nullptr; /* unlinked */
|
if(alt->fiftyval == -1) return nullptr; /* unlinked */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
h->alt = alt;
|
h->alt = alt;
|
||||||
alt->cdata = (cdata*) h;
|
alt->cdata = (cdata*) h;
|
||||||
currentmap->link_alt(bf);
|
currentmap->link_alt(bf);
|
||||||
|
@ -1499,7 +1512,10 @@ EX void buildBigStuff(cell *c, cell *from) {
|
||||||
buildBarrier4(c, bd, 0, getNewLand(c->land), c->land); */
|
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() &&
|
(quickfind(laCamelot) || peace::on || (hrand(I2000) < (c->land == laCrossroads4 ? 800 : 200) && horo_ok() &&
|
||||||
items[itEmerald] >= U5 && !tactic::on && !racing::on))) {
|
items[itEmerald] >= U5 && !tactic::on && !racing::on))) {
|
||||||
int rtr = newRoundTableRadius();
|
int rtr = newRoundTableRadius();
|
||||||
|
|
6
cell.cpp
6
cell.cpp
|
@ -148,8 +148,10 @@ EX hrmap *currentmap;
|
||||||
EX vector<hrmap*> allmaps;
|
EX vector<hrmap*> allmaps;
|
||||||
|
|
||||||
EX hrmap *newAltMap(heptagon *o) {
|
EX hrmap *newAltMap(heptagon *o) {
|
||||||
|
#if MAXMDIM >= 4
|
||||||
if(reg3::in_rule())
|
if(reg3::in_rule())
|
||||||
return reg3::new_alt_map(o);
|
return reg3::new_alt_map(o);
|
||||||
|
#endif
|
||||||
return new hrmap_hyperbolic(o);
|
return new hrmap_hyperbolic(o);
|
||||||
}
|
}
|
||||||
// --- hyperbolic geometry ---
|
// --- hyperbolic geometry ---
|
||||||
|
@ -524,11 +526,13 @@ EX int celldistAlt(cell *c) {
|
||||||
/** direction upwards in the tree */
|
/** direction upwards in the tree */
|
||||||
EX int updir(heptagon *h) {
|
EX int updir(heptagon *h) {
|
||||||
if(bt::in()) return bt::updir();
|
if(bt::in()) return bt::updir();
|
||||||
|
#if MAXMDIM >= 4
|
||||||
if(WDIM == 3 && reg3::in_rule()) {
|
if(WDIM == 3 && reg3::in_rule()) {
|
||||||
for(int i=0; i<S7; i++) if(h->move(i) && h->move(i)->distance < h->distance)
|
for(int i=0; i<S7; i++) if(h->move(i) && h->move(i)->distance < h->distance)
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if(h->distance == 0) return -1;
|
if(h->distance == 0) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -536,11 +540,13 @@ EX int updir(heptagon *h) {
|
||||||
/** direction upwards in the alt-tree */
|
/** direction upwards in the alt-tree */
|
||||||
EX int updir_alt(heptagon *h) {
|
EX int updir_alt(heptagon *h) {
|
||||||
if(euclid || !h->alt) return -1;
|
if(euclid || !h->alt) return -1;
|
||||||
|
#if MAXMDIM >= 4
|
||||||
if(WDIM == 3 && reg3::in_rule()) {
|
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)
|
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 i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
for(int i=0; i<S7; i++)
|
for(int i=0; i<S7; i++)
|
||||||
if(h->move(i) && h->move(i)->alt == h->alt->move(0))
|
if(h->move(i) && h->move(i)->alt == h->alt->move(0))
|
||||||
return i;
|
return i;
|
||||||
|
|
|
@ -872,10 +872,12 @@ void celldrawer::draw_halfvine() {
|
||||||
queuepolyat(GDIM == 2 ? Vdepth : V2, cgi.shSemiFloor[0], darkena(vcol, fd, 0xFF), PPR::WALL3A);
|
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); }
|
{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));
|
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) {
|
if(GDIM == 3 && qfi.fshape) {
|
||||||
side.tinf = &floor_texture_vertices[shar.id];
|
side.tinf = &floor_texture_vertices[shar.id];
|
||||||
ensure_vertex_number(*side.tinf, side.cnt);
|
ensure_vertex_number(*side.tinf, side.cnt);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, j, c) {
|
if(cgi.validsidepar[SIDE_WALL]) forCellIdEx(c2, j, c) {
|
||||||
int dis = i-j;
|
int dis = i-j;
|
||||||
|
@ -1529,6 +1531,7 @@ void celldrawer::draw_features() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void celldrawer::draw_features_and_walls_3d() {
|
void celldrawer::draw_features_and_walls_3d() {
|
||||||
|
#if MAXMDIM >= 4
|
||||||
color_t dummy;
|
color_t dummy;
|
||||||
int ofs = wall_offset(c);
|
int ofs = wall_offset(c);
|
||||||
if(isWall3(c, wcol)) {
|
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));
|
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x804060, 0, 0xFF));
|
||||||
if(rd == 2)
|
if(rd == 2)
|
||||||
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x402030, 0, 0xFF));
|
queuepoly(face_the_player(V), cgi.shLoveRing, darkena(0x402030, 0, 0xFF));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
|
|
|
@ -299,6 +299,9 @@ struct fpattern {
|
||||||
|
|
||||||
unsigned compute_hash();
|
unsigned compute_hash();
|
||||||
|
|
||||||
|
void set_field(int p, int sq);
|
||||||
|
|
||||||
|
#if MAXMDIM >= 4
|
||||||
// general 4D
|
// general 4D
|
||||||
vector<transmatrix> fullv;
|
vector<transmatrix> fullv;
|
||||||
|
|
||||||
|
@ -308,12 +311,10 @@ struct fpattern {
|
||||||
int solve3();
|
int solve3();
|
||||||
bool generate_all3();
|
bool generate_all3();
|
||||||
|
|
||||||
void set_field(int p, int sq);
|
|
||||||
// transmatrix full_R, full_P, full_X;
|
|
||||||
|
|
||||||
#if CAP_THREAD
|
#if CAP_THREAD
|
||||||
struct discovery *dis;
|
struct discovery *dis;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CAP_THREAD
|
#if CAP_THREAD
|
||||||
|
@ -377,6 +378,7 @@ vector<matrix> fpattern::generate_isometries() {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MAXMDIM >= 4
|
||||||
vector<matrix> fpattern::generate_isometries3() {
|
vector<matrix> fpattern::generate_isometries3() {
|
||||||
|
|
||||||
matrix T = Id;
|
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);
|
matcode[M] = i, matrices.push_back(M), fullv.push_back(Full);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
map<unsigned,int> hash_found;
|
map<unsigned,int> hash_found;
|
||||||
|
|
||||||
|
@ -469,6 +472,7 @@ unsigned fpattern::compute_hash() {
|
||||||
return hashv;
|
return hashv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MAXMDIM >= 4
|
||||||
bool fpattern::generate_all3() {
|
bool fpattern::generate_all3() {
|
||||||
|
|
||||||
reg3::generate_fulls();
|
reg3::generate_fulls();
|
||||||
|
@ -554,6 +558,7 @@ int fpattern::solve3() {
|
||||||
|
|
||||||
return cmb;
|
return cmb;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void fpattern::set_field(int p, int sq) {
|
void fpattern::set_field(int p, int sq) {
|
||||||
Prime = p;
|
Prime = p;
|
||||||
|
@ -586,6 +591,7 @@ int fpattern::solve() {
|
||||||
}
|
}
|
||||||
} else wsquare = 0;
|
} else wsquare = 0;
|
||||||
|
|
||||||
|
#if MAXMDIM >= 4
|
||||||
if(WDIM == 3) {
|
if(WDIM == 3) {
|
||||||
if(dual == 0 && (Prime <= limitsq || pw == 1)) {
|
if(dual == 0 && (Prime <= limitsq || pw == 1)) {
|
||||||
int s = solve3();
|
int s = solve3();
|
||||||
|
@ -593,6 +599,7 @@ int fpattern::solve() {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(dual == 2) {
|
if(dual == 2) {
|
||||||
if(Field <= 10) {
|
if(Field <= 10) {
|
||||||
|
@ -1325,7 +1332,9 @@ EX void hread_fpattern(hstream& hs, fieldpattern::fpattern& fp) {
|
||||||
hread(hs, fp.R);
|
hread(hs, fp.R);
|
||||||
hread(hs, fp.X);
|
hread(hs, fp.X);
|
||||||
fp.set_field(fp.Prime, fp.wsquare);
|
fp.set_field(fp.Prime, fp.wsquare);
|
||||||
|
#if MAXMDIM >= 4
|
||||||
fp.generate_all3();
|
fp.generate_all3();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void hwrite_fpattern(hstream& hs, fieldpattern::fpattern& fp) {
|
EX void hwrite_fpattern(hstream& hs, fieldpattern::fpattern& fp) {
|
||||||
|
|
|
@ -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) {
|
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);
|
ld d = hdist(V1*h1, V2*h2);
|
||||||
|
|
||||||
|
#if MAXMDIM >= 4
|
||||||
if(WDIM == 3 && fat_edges) {
|
if(WDIM == 3 && fat_edges) {
|
||||||
transmatrix T = V1 * rgpushxto0(h1);
|
transmatrix T = V1 * rgpushxto0(h1);
|
||||||
transmatrix S = rspintox(inverse(T) * V2 * h2);
|
transmatrix S = rspintox(inverse(T) * V2 * h2);
|
||||||
queuepoly(T * S, cgi.generate_pipe(d, vid.linewidth), col);
|
queuepoly(T * S, cgi.generate_pipe(d, vid.linewidth), col);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
while(d > precise_width && d < 100 && grid_depth < 10) {
|
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; }
|
if(!eqmatrix(V1, V2, 1e-6)) { gridline(V1, h1, V1, inverse(V1) * V2 * h2, col, prec); return; }
|
||||||
|
|
|
@ -667,6 +667,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
|
||||||
#endif
|
#endif
|
||||||
else if(arb::in() && arb::current.have_line)
|
else if(arb::in() && arb::current.have_line)
|
||||||
c->wall = arb::linespattern(c) ? waTrapdoor : waNone;
|
c->wall = arb::linespattern(c) ? waTrapdoor : waNone;
|
||||||
|
#if MAXMDIM >= 4
|
||||||
else if(reg3::in_rule()) switch(geometry) {
|
else if(reg3::in_rule()) switch(geometry) {
|
||||||
case gSpace534: {
|
case gSpace534: {
|
||||||
if(c->master->fieldval == 0) c->wall = waTrapdoor;
|
if(c->master->fieldval == 0) c->wall = waTrapdoor;
|
||||||
|
@ -690,6 +691,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
|
||||||
}
|
}
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else if(euclid && !arcm::in()) {
|
else if(euclid && !arcm::in()) {
|
||||||
auto co = euc2_coordinates(c);
|
auto co = euc2_coordinates(c);
|
||||||
int y = co.second;
|
int y = co.second;
|
||||||
|
|
Loading…
Reference in New Issue