1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

adjusted for older compilers

This commit is contained in:
Zeno Rogue 2019-11-30 18:28:29 +01:00
parent 42125679a7
commit 89cfc2bce1
4 changed files with 17 additions and 15 deletions

View File

@ -707,7 +707,7 @@ EX namespace euclid3 {
} }
#if HDR #if HDR
using torus_config = pair<euclid3::intmatrix, int>; typedef pair<euclid3::intmatrix, int> torus_config;
#endif #endif
euclid3::intmatrix on_periods(gp::loc a, gp::loc b) { 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) { 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) { torus_config regular_torus(gp::loc p) {
@ -824,12 +824,12 @@ EX namespace euclid3 {
} }
dialog::addBreak(50); dialog::addBreak(50);
torus_config_option(XLAT("single-cell torus"), 'A', regular_torus({1,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({12, 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("Klein bottle"), 'C', rectangular_torus(12, 6, true));
torus_config_option(XLAT("cylinder"), 'D', rectangular_torus(6, 0, false)); torus_config_option(XLAT("cylinder"), 'D', rectangular_torus(6, 0, false));
torus_config_option(XLAT("Möbius band"), 'E', rectangular_torus(6, 0, true)); 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)); 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)); 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<gp::loc, cdata>& get_cdata() { return euclid3::eucmap()->eucdata; } EX map<gp::loc, cdata>& get_cdata() { return euclid3::eucmap()->eucdata; }
EX transmatrix eumove(euclid3::coord co) { EX transmatrix eumove(euclid3::coord co) {
constexpr double q3 = sqrt(double(3)); const double q3 = sqrt(double(3));
if(WDIM == 3) { if(WDIM == 3) {
return eupush3(co[0], co[1], co[2]); return eupush3(co[0], co[1], co[2]);
} }

View File

@ -348,8 +348,8 @@ transmatrix hrmap_standard::adj(cell *c, int i) {
if(GOLDBERG && gp::do_adjm) { if(GOLDBERG && gp::do_adjm) {
transmatrix T = master_relative(c, true); transmatrix T = master_relative(c, true);
transmatrix U = master_relative(c->cmove(i), false); transmatrix U = master_relative(c->cmove(i), false);
if(gp::gp_adj.count({c,i})) { if(gp::gp_adj.count(make_pair(c,i))) {
return T * gp::gp_adj[{c, i}] * U; return T * gp::get_adj(c,i) * U;
} }
else else
println(hlog, "gpadj not found"); println(hlog, "gpadj not found");

View File

@ -188,14 +188,14 @@ EX namespace gp {
DEBB(DF_GP, (at1, " : ", (wcw+wstep), " / ", wcw1, " (pull error from ", at, " :: ", wcw, ")") ); DEBB(DF_GP, (at1, " : ", (wcw+wstep), " / ", wcw1, " (pull error from ", at, " :: ", wcw, ")") );
exit(1); 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; return false;
} }
if(peek(wcw)) { if(peek(wcw)) {
set_localwalk(wc1, dir1, wcw + wstep); set_localwalk(wc1, dir1, wcw + wstep);
DEBB(DF_GP, (at1, " :", wcw+wstep, " (pulled from ", at, " :: ", wcw, ")")); 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 true;
} }
return false; return false;
@ -214,7 +214,7 @@ EX namespace gp {
if(peek(wcw)) { if(peek(wcw)) {
DEBB0(DF_GP, ("(pulled) "); ) DEBB0(DF_GP, ("(pulled) "); )
set_localwalk(wc1, dir1, wcw + wstep); 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 { else {
peek(wcw) = newCell(SG6, wc.cw.at->master); peek(wcw) = newCell(SG6, wc.cw.at->master);
@ -245,8 +245,8 @@ EX namespace gp {
} }
} }
if(do_adjm) { if(do_adjm) {
gp_adj[{wcw.at, wcw.spin}] = inverse(wc.adjm) * wc1.adjm; get_adj(wcw.at, wcw.spin) = inverse(wc.adjm) * wc1.adjm;
gp_adj[{wcw1.at, wcw1.spin}] = inverse(wc1.adjm) * wc.adjm; get_adj(wcw1.at, wcw1.spin) = inverse(wc1.adjm) * wc.adjm;
} }
} }
@ -256,6 +256,8 @@ EX namespace gp {
} }
EX map<pair<cell*, int>, transmatrix> gp_adj; EX map<pair<cell*, int>, 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) { goldberg_mapping_t& set_heptspin(loc at, heptspin hs) {
auto& ac0 = get_mapping(at); auto& ac0 = get_mapping(at);

View File

@ -192,7 +192,7 @@ EX namespace models {
if(euclid) { if(euclid) {
euclidean_spin = pispin * inverse(cview() * master_relative(centerover, true)); euclidean_spin = pispin * inverse(cview() * master_relative(centerover, true));
euclidean_spin = gpushxto0(euclidean_spin * C0) * euclidean_spin; 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]); 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 y=0; y<=200; y++)
for(int x=-200; x<=200; x++) { for(int x=-200; x<=200; x++) {
if(y == 0 && x <= 0) continue; 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) if(zero == euclid3::euzero)
torus_zeros.emplace_back(x, y); torus_zeros.emplace_back(x, y);
} }