From 67a19d93bb7d434423800a400779b7b8d5ba5225 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 17 Feb 2022 21:00:10 +0100 Subject: [PATCH] added missing MAXMDIM guards --- fake.cpp | 4 ++++ geom-exp.cpp | 2 ++ geometry.cpp | 12 +++++++++++- goldberg.cpp | 2 ++ graph.cpp | 2 ++ hypgraph.cpp | 2 ++ intra.cpp | 3 ++- mapeditor.cpp | 20 ++++++++++++++++++++ 8 files changed, 45 insertions(+), 2 deletions(-) diff --git a/fake.cpp b/fake.cpp index 2e6f9ce4..9a3f4174 100644 --- a/fake.cpp +++ b/fake.cpp @@ -373,12 +373,16 @@ EX namespace fake { transmatrix ray_iadj(cell *c, int i) override { if(WDIM == 2) return to_other_side(get_corner(c, i), get_corner(c, i+1)); + #if MAXMDIM >= 4 if(PURE) return iadj(c, i); auto& v = get_cellshape(c).faces_local[i]; hyperpoint h = project_on_triangle(v[0], v[1], v[2]); transmatrix T = rspintox(h); return T * xpush(-2*hdist0(h)) * spintox(h); + #else + return Id; + #endif } }; diff --git a/geom-exp.cpp b/geom-exp.cpp index 44769f69..ec9924d5 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -1270,6 +1270,7 @@ int read_geom_args() { PHASEFROM(2); set_variation(eVariation::warped); } + #if MAXMDIM >= 4 else if(argis("-subcubes")) { PHASEFROM(2); stop_game(); @@ -1301,6 +1302,7 @@ int read_geom_args() { shift(); reg3::coxeter_param = argi(); } #endif + #endif #if CAP_FIELD else if(argis("-fi")) { fieldpattern::info(); diff --git a/geometry.cpp b/geometry.cpp index 3a8a8b7c..f9432e9a 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -744,10 +744,12 @@ void geometry_information::prepare_basics() { base_distlimit = arb::current.range; } + #if MAXMDIM >= 4 if(is_subcube_based(variation)) { scalefactor /= reg3::subcube_count; orbsize /= reg3::subcube_count; } + #endif if(scale_used()) { scalefactor *= vid.creature_scale; @@ -1142,8 +1144,10 @@ EX string cgi_string() { if(GOLDBERG_INV) V("GP", its(gp::param.first) + "," + its(gp::param.second)); if(IRREGULAR) V("IRR", its(irr::irrid)); + #if MAXMDIM >= 4 if(is_subcube_based(variation)) V("SC", its(reg3::subcube_count)); if(variation == eVariation::coxeter) V("COX", its(reg3::coxeter_param)); + #endif #if CAP_ARCM if(arcm::in()) V("ARCM", arcm::current.symbol); @@ -1198,6 +1202,12 @@ EX string cgi_string() { return s; } +#if MAXMDIM >= 4 +#define IFINTRA(x,y) x +#else +#define IFINTRA(x,y) y +#endif + EX void check_cgi() { string s = cgi_string(); @@ -1207,7 +1217,7 @@ EX void check_cgi() { if(fake::in()) fake::underlying_cgip->timestamp = ntimestamp; if(arcm::alt_cgip) arcm::alt_cgip->timestamp = ntimestamp; - if(isize(cgis) > 4 && intra::data.empty()) { + if(isize(cgis) > 4 && IFINTRA(intra::data.empty(), true)) { vector> timestamps; for(auto& t: cgis) timestamps.emplace_back(-t.second.timestamp, t.first); sort(timestamps.begin(), timestamps.end()); diff --git a/goldberg.cpp b/goldberg.cpp index cc26d9c5..d3cc3d6e 100644 --- a/goldberg.cpp +++ b/goldberg.cpp @@ -1162,6 +1162,7 @@ EX namespace gp { return S3 == 3 ? XLAT("chamfered") : XLAT("expanded"); else if(GOLDBERG && param == loc(3, 0) && S3 == 3) return XLAT("2x bitruncated"); + #if MAXMDIM >= 4 else if(variation == eVariation::subcubes) return XLAT("subcubed") + "(" + its(reg3::subcube_count) + ")"; else if(variation == eVariation::dual_subcubes) @@ -1170,6 +1171,7 @@ EX namespace gp { return XLAT("bitruncated-subcubed") + "(" + its(reg3::subcube_count) + ")"; else if(variation == eVariation::coxeter) return XLAT("subdivided") + "(" + its(reg3::coxeter_param) + ")"; + #endif else { auto p = human_representation(param); string s = "GP(" + its(p.first) + "," + its(p.second) + ")"; diff --git a/graph.cpp b/graph.cpp index 84bac197..95c92e6d 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3808,10 +3808,12 @@ EX int get_darkval(cell *c, int d) { const int darkval_kite[12] = {0, 2, 0, 2, 4, 4, 6, 6, 6, 6, 6, 6}; const int darkval_nil[8] = {6,6,0,3,6,6,0,3}; const int darkval_nih[11] = {0,2,0,2,4,6,6,6,6,6,6}; + #if MAXMDIM >= 4 if(among(variation, eVariation::dual_subcubes, eVariation::bch, eVariation::bch_oct, eVariation::coxeter)) { int v = reg3::get_face_vertex_count(c, d); return v-3; } + #endif if(sphere) return darkval_s12[d]; if(euclid && S7 == 6) return darkval_e6[d]; if(euclid && S7 == 12) return darkval_e12[d]; diff --git a/hypgraph.cpp b/hypgraph.cpp index fd829428..0e03f100 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -2907,7 +2907,9 @@ EX void shift_view(hyperpoint H) { static bool recursive = false; if(!recursive && intra::in) { dynamicval r(recursive, true); + #if MAXMDIM >= 4 intra::shift_view_portal(H); + #endif return; } View = get_shift_view_of(H, View); diff --git a/intra.cpp b/intra.cpp index 02f5bcc0..e2d1141f 100644 --- a/intra.cpp +++ b/intra.cpp @@ -6,6 +6,7 @@ EX namespace intra { EX bool in; +#if MAXMDIM >= 4 #if HDR /** information per every space connected with intra-portals */ struct intra_data { @@ -766,6 +767,6 @@ auto hooks1 = + arg::add3("-debug-portal", [] { arg::shift(); debug_portal = arg::argi(); }); +#endif EX } - } \ No newline at end of file diff --git a/mapeditor.cpp b/mapeditor.cpp index 2aebea61..20315092 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -449,12 +449,14 @@ EX namespace mapstream { f.write(gp::param.second); } #endif + #if MAXMDIM >= 4 if(variation == eVariation::coxeter) { f.write(reg3::coxeter_param); } if(is_subcube_based(variation )) { f.write(reg3::subcube_count); } + #endif #if CAP_FIELD if(geometry == gFieldQuotient) { using namespace fieldpattern; @@ -541,12 +543,14 @@ EX namespace mapstream { f.read(gp::param.second); } #endif + #if MAXMDIM >= 4 if(variation == eVariation::coxeter && vernum >= 0xA908) { f.read(reg3::coxeter_param); } if(is_subcube_based(variation) && vernum >= 0xA908) { f.read(reg3::subcube_count); } + #endif #if CAP_CRYSTAL if(cryst && vernum >= 10504) { int sides; @@ -702,7 +706,9 @@ EX namespace mapstream { } addToQueue(save_start()); + #if MAXMDIM >= 4 if(intra::in) intra::prepare_need_to_save(); + #endif for(int i=0; iwparam); f.write(c->landparam); f.write_char(c->stuntime); f.write_char(c->hitpoints); bool blocked = false; + #if MAXMDIM >= 4 if(intra::in && isWall3(c) && !intra::need_to_save.count(c)) blocked = true; + #endif if(!blocked) for(int j=0; jtype; j++) { cell *c2 = c->move(j); @@ -771,6 +779,7 @@ EX namespace mapstream { for(int i=0; i= 4 if(intra::in) { for(int i=0; i(0); } + #endif callhooks(hooks_savemap, f); f.write(0); @@ -1002,6 +1012,7 @@ EX namespace mapstream { } } + #if MAXMDIM >= 4 if(intra::in) { while(true) { char k = f.get(); @@ -1015,6 +1026,7 @@ EX namespace mapstream { cw.spin = fixspin(relspin[id], spin, cw.at->type, f.vernum); } } + #endif if(f.vernum >= 0xA848) { int i; @@ -1060,9 +1072,14 @@ EX namespace mapstream { if(!f.f) return false; f.write(f.vernum); f.write(dual::state); + #if MAXMDIM >= 4 int q = intra::in ? isize(intra::data) : 0; f.write(q); + #else + int q = 0; + #endif if(q) { + #if MAXMDIM >= 4 intra::prepare_to_save(); int qp = isize(intra::portals_to_save); f.write(qp); @@ -1072,6 +1089,7 @@ EX namespace mapstream { } intra::resetter ir; for(int i=0; i= 4 intra::portals_to_save.resize(qp); for(auto& ps: intra::portals_to_save) { f.read(ps.spin); @@ -1116,6 +1135,7 @@ EX namespace mapstream { } intra::start(); intra::load_saved_portals(); + #endif } else { dual::split_or_do([&] { load_only_map(f); });