added missing MAXMDIM guards

This commit is contained in:
Zeno Rogue 2022-02-17 21:00:10 +01:00
parent 4394502e3e
commit 67a19d93bb
8 changed files with 45 additions and 2 deletions

View File

@ -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
}
};

View File

@ -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();

View File

@ -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<pair<int, string>> timestamps;
for(auto& t: cgis) timestamps.emplace_back(-t.second.timestamp, t.first);
sort(timestamps.begin(), timestamps.end());

View File

@ -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) + ")";

View File

@ -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];

View File

@ -2907,7 +2907,9 @@ EX void shift_view(hyperpoint H) {
static bool recursive = false;
if(!recursive && intra::in) {
dynamicval<bool> r(recursive, true);
#if MAXMDIM >= 4
intra::shift_view_portal(H);
#endif
return;
}
View = get_shift_view_of(H, View);

View File

@ -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 }
}

View File

@ -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; i<isize(cellbyid); i++) {
cell *c = cellbyid[i];
if(i) {
@ -745,7 +751,9 @@ EX namespace mapstream {
f.write(c->wparam); 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; j<c->type; j++) {
cell *c2 = c->move(j);
@ -771,6 +779,7 @@ EX namespace mapstream {
for(int i=0; i<multi::players; i++)
f.write(cellids[multi::player[i].at]);
#if MAXMDIM >= 4
if(intra::in) {
for(int i=0; i<isize(intra::portals_to_save); i++) {
auto& p = intra::portals_to_save[i];
@ -789,6 +798,7 @@ EX namespace mapstream {
}
f.write<char>(0);
}
#endif
callhooks(hooks_savemap, f);
f.write<int>(0);
@ -1002,6 +1012,7 @@ EX namespace mapstream {
}
}
#if MAXMDIM >= 4
if(intra::in) {
while(true) {
char k = f.get<char>();
@ -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<q; i++) { intra::switch_to(i); save_only_map(f); }
#endif
}
else {
// make sure we save in correct order
@ -1102,6 +1120,7 @@ EX namespace mapstream {
if(q) {
int qp;
f.read(qp);
#if MAXMDIM >= 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); });