From 89cfc2bce14e67186448be5df813ad6384f6fa51 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 30 Nov 2019 18:28:29 +0100 Subject: [PATCH] adjusted for older compilers --- euclid.cpp | 12 ++++++------ geometry2.cpp | 4 ++-- goldberg.cpp | 12 +++++++----- models.cpp | 4 ++-- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/euclid.cpp b/euclid.cpp index 197fcf2a..7af55c37 100644 --- a/euclid.cpp +++ b/euclid.cpp @@ -707,7 +707,7 @@ EX namespace euclid3 { } #if HDR - using torus_config = pair; + typedef pair torus_config; #endif euclid3::intmatrix on_periods(gp::loc a, gp::loc b) { @@ -722,7 +722,7 @@ EX namespace euclid3 { } torus_config single_row_torus(int qty, int dy) { - return { on_periods({dy, -1}, {qty, 0}), false }; + return { on_periods(gp::loc{dy, -1}, gp::loc{qty, 0}), false }; } torus_config regular_torus(gp::loc p) { @@ -824,12 +824,12 @@ EX namespace euclid3 { } dialog::addBreak(50); - torus_config_option(XLAT("single-cell torus"), 'A', regular_torus({1,0})); - torus_config_option(XLAT("large regular torus"), 'B', regular_torus({12, 0})); + torus_config_option(XLAT("single-cell torus"), 'A', regular_torus(gp::loc{1,0})); + torus_config_option(XLAT("large regular torus"), 'B', regular_torus(gp::loc{12, 0})); torus_config_option(XLAT("Klein bottle"), 'C', rectangular_torus(12, 6, true)); torus_config_option(XLAT("cylinder"), 'D', rectangular_torus(6, 0, false)); torus_config_option(XLAT("Möbius band"), 'E', rectangular_torus(6, 0, true)); - if(S3 == 3) torus_config_option(XLAT("seven-colorable torus"), 'F', regular_torus({1,2})); + if(S3 == 3) torus_config_option(XLAT("seven-colorable torus"), 'F', regular_torus(gp::loc{1,2})); if(S3 == 3) torus_config_option(XLAT("HyperRogue classic torus"), 'G', single_row_torus(381, -22)); torus_config_option(XLAT("no quotient"), 'H', rectangular_torus(0, 0, false)); @@ -1027,7 +1027,7 @@ EX gp::loc to_loc(const euclid3::coord& v) { return gp::loc(v[0], v[1]); } EX map& get_cdata() { return euclid3::eucmap()->eucdata; } EX transmatrix eumove(euclid3::coord co) { - constexpr double q3 = sqrt(double(3)); + const double q3 = sqrt(double(3)); if(WDIM == 3) { return eupush3(co[0], co[1], co[2]); } diff --git a/geometry2.cpp b/geometry2.cpp index 445f20f2..b2c87566 100644 --- a/geometry2.cpp +++ b/geometry2.cpp @@ -348,8 +348,8 @@ transmatrix hrmap_standard::adj(cell *c, int i) { if(GOLDBERG && gp::do_adjm) { transmatrix T = master_relative(c, true); transmatrix U = master_relative(c->cmove(i), false); - if(gp::gp_adj.count({c,i})) { - return T * gp::gp_adj[{c, i}] * U; + if(gp::gp_adj.count(make_pair(c,i))) { + return T * gp::get_adj(c,i) * U; } else println(hlog, "gpadj not found"); diff --git a/goldberg.cpp b/goldberg.cpp index c2e9c2fa..aab123dc 100644 --- a/goldberg.cpp +++ b/goldberg.cpp @@ -188,14 +188,14 @@ EX namespace gp { DEBB(DF_GP, (at1, " : ", (wcw+wstep), " / ", wcw1, " (pull error from ", at, " :: ", wcw, ")") ); exit(1); } - if(do_adjm) wc1.adjm = wc.adjm * gp_adj[{wcw.at, wcw.spin}]; + if(do_adjm) wc1.adjm = wc.adjm * get_adj(wcw.at, wcw.spin); } return false; } if(peek(wcw)) { set_localwalk(wc1, dir1, wcw + wstep); DEBB(DF_GP, (at1, " :", wcw+wstep, " (pulled from ", at, " :: ", wcw, ")")); - if(do_adjm) wc1.adjm = wc.adjm * gp_adj[{wcw.at, wcw.spin}]; + if(do_adjm) wc1.adjm = wc.adjm * get_adj(wcw.at, wcw.spin); return true; } return false; @@ -214,7 +214,7 @@ EX namespace gp { if(peek(wcw)) { DEBB0(DF_GP, ("(pulled) "); ) set_localwalk(wc1, dir1, wcw + wstep); - if(do_adjm) wc1.adjm = wc.adjm * gp_adj[{wcw.at, wcw.spin}]; + if(do_adjm) wc1.adjm = wc.adjm * get_adj(wcw.at, wcw.spin); } else { peek(wcw) = newCell(SG6, wc.cw.at->master); @@ -245,8 +245,8 @@ EX namespace gp { } } if(do_adjm) { - gp_adj[{wcw.at, wcw.spin}] = inverse(wc.adjm) * wc1.adjm; - gp_adj[{wcw1.at, wcw1.spin}] = inverse(wc1.adjm) * wc.adjm; + get_adj(wcw.at, wcw.spin) = inverse(wc.adjm) * wc1.adjm; + get_adj(wcw1.at, wcw1.spin) = inverse(wc1.adjm) * wc.adjm; } } @@ -256,6 +256,8 @@ EX namespace gp { } EX map, transmatrix> gp_adj; + + EX transmatrix& get_adj(cell *c, int i) { return gp_adj[make_pair(c,i)]; } goldberg_mapping_t& set_heptspin(loc at, heptspin hs) { auto& ac0 = get_mapping(at); diff --git a/models.cpp b/models.cpp index 57cdf3bf..a07a8a85 100644 --- a/models.cpp +++ b/models.cpp @@ -192,7 +192,7 @@ EX namespace models { if(euclid) { euclidean_spin = pispin * inverse(cview() * master_relative(centerover, true)); euclidean_spin = gpushxto0(euclidean_spin * C0) * euclidean_spin; - hyperpoint h = inverse(euclidean_spin) * (C0 + (eumove(to_coord({1,0}))*C0 - C0) * spiral_x + (eumove(to_coord({0,1}))*C0 - C0) * spiral_y); + hyperpoint h = inverse(euclidean_spin) * (C0 + (eumove(to_coord(gp::loc{1,0}))*C0 - C0) * spiral_x + (eumove(to_coord(gp::loc{0,1}))*C0 - C0) * spiral_y); spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]); } @@ -267,7 +267,7 @@ EX namespace models { for(int y=0; y<=200; y++) for(int x=-200; x<=200; x++) { if(y == 0 && x <= 0) continue; - auto zero = euclid3::canonicalize(to_coord({x, y})); + auto zero = euclid3::canonicalize(to_coord(gp::loc{x, y})); if(zero == euclid3::euzero) torus_zeros.emplace_back(x, y); }