From f46967efb979c8fc2afd9f28d9c6ef7a3716e231 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 30 Nov 2019 18:47:43 +0100 Subject: [PATCH] removed assignment of gp::loc to tie as Clang does not like it --- bigstuff.cpp | 37 +++++++++++++++++++------------------ cell.cpp | 3 +-- complex.cpp | 16 ++++++++-------- landgen.cpp | 23 ++++++++++++----------- models.cpp | 4 +++- pattern2.cpp | 16 ++++++++-------- 6 files changed, 51 insertions(+), 48 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index 894db67f..c89c21a8 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -1089,18 +1089,18 @@ EX void setLandEuclid(cell *c) { #endif setland(c, specialland); if(specialland == laCrossroads4 || chaosmode) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int y = co.second; c->land = getEuclidLand(y); } if(specialland == laCrossroads) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; setland(c, getEuclidLand(y+2*x)); } if(specialland == laTerracotta) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; if(((y+2*x) & 15) == 1) { setland(c, laMercuryRiver); c->wall = waMercury; @@ -1112,8 +1112,8 @@ EX void setLandEuclid(cell *c) { } if(specialland == laPrincessQuest) setland(c, laPalace); if(specialland == laOcean) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int y = co.second; y += 10; if(euclid && quotient) y = -celldistAlt(c); if(y == 0) @@ -1122,8 +1122,8 @@ EX void setLandEuclid(cell *c) { else c->landparam = y; } if(specialland == laWestWall) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first; x = -5 - x; if(x == 0) {setland(c, laBarrier); if(ishept(c)) setland(c, laMotion); } @@ -1131,8 +1131,9 @@ EX void setLandEuclid(cell *c) { else c->landparam = x; } if(specialland == laIvoryTower || specialland == laDungeon) { - int x, y; - tie(x,y) = euc2_coordinates(c); y = -5 - y; + auto co = euc2_coordinates(c); + int y = co.second; + y = -5 - y; if(specialland == laDungeon) y = -10 - y; if(euclid && quotient) y = -celldistAlt(c); if(y == 0) @@ -1143,8 +1144,8 @@ EX void setLandEuclid(cell *c) { } } if(specialland == laElementalWall) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; int x0 = euclid4 ? x : x + (y>>1); int y0 = y; @@ -1172,8 +1173,8 @@ EX void setLandEuclid(cell *c) { } } if(specialland == laCrossroads3) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; int y0 = euclid4 ? 2 * y - x : y; int x0 = euclid4 ? 2 * x + y : x + y/2; @@ -1191,8 +1192,8 @@ EX void setLandEuclid(cell *c) { } } if(specialland == laWarpCoast) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; int zz = a4 ? x : 2*x+y + 10; zz = gmod(zz, 30); diff --git a/cell.cpp b/cell.cpp index 163883ee..44578526 100644 --- a/cell.cpp +++ b/cell.cpp @@ -795,8 +795,7 @@ cdata *getHeptagonCdata(heptagon *h) { cdata *getEuclidCdata(gp::loc h) { - int x, y; - tie(x,y) = h; + int x = h.first, y = h.second; auto& data = archimedean ? arcm::get_cdata() : get_cdata(); // hrmap_euclidean* euc = dynamic_cast (currentmap); diff --git a/complex.cpp b/complex.cpp index 84677cb7..f9c92b2c 100644 --- a/complex.cpp +++ b/complex.cpp @@ -16,8 +16,8 @@ EX namespace whirlwind { if(archimedean) return 0; if(euclid) { if(bounded) return 0; - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int y = co.second; return 1+((((signed short)(y)+int(50000))/3)%3); } if(S7 == 5) return getHemisphere(c, 0) > 0 ? 1 : 2; @@ -870,8 +870,8 @@ EX namespace clearing { if(pseudohept(c)) return; c->monst = moMutant; - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; int xco = x * 2 + y + 1; c->stuntime = (8-xco/2) & 15; @@ -2982,8 +2982,8 @@ EX namespace prairie { c->LHU.fi.rval = 0; } else if(euclid) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int y = co.second; c->LHU.fi.rval = (y&15); } else if(sphere) { @@ -3760,8 +3760,8 @@ EX namespace dungeon { if(euclid) { if(quotient) return; - int x, y; - tie(x, y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; string tab6[] = { ".####...", "L...L...", diff --git a/landgen.cpp b/landgen.cpp index 7ad1e7fc..5bb9a2cc 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -508,8 +508,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { c->wall = euclid3::get_emerald(c) ? waCavewall : waCavefloor; #endif else if(euclid) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int y = co.second; if(((y-2)&7) < 4) c->wall = waCavewall; else c->wall = waCavefloor; } @@ -599,8 +599,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { v = hrand(100) < 25 ? 24 : 16; } else if(euclid) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int y = co.second; int y0 = gmod(y, 6); if(y0 == 3 || y0 == 4) v=24; else v=0; } @@ -662,8 +662,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { c->wall = arcm::linespattern(c) ? waTrapdoor : waNone; #endif else if(euclid && !archimedean) { - int x,y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int y = co.second; if(y&1) c->wall = waTrapdoor; else c->wall = waNone; } @@ -698,8 +698,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { c->wall = waVinePlant; } else if(euclid && !archimedean) { - int x,y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int y = co.second; int dy = gmod(y, 3); if(dy == 1) c->wall = waVinePlant; } @@ -1292,8 +1292,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { if(c == at_euc2_coordinates(s-st)) c->wall = waGrounded; } else if(euclid && WDIM == 2) { - int x,y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; if((x+1)%3 == 0 && y%3 == 0) { if(hrand(100) < 50) c->wall = hrand(2) ? waCharged : waGrounded; @@ -1302,7 +1302,8 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { bool sand = false; for(int i=0; itype; i++) { createMov(c, i); - tie(x,y) = euc2_coordinates(c->move(i)); + auto co = euc2_coordinates(c->move(i)); + int x = co.first, y = co.second; if((x+1)%3 == 0 && (y)%3 == 0) sand = true; } if(sand && hrand(100) < 20) diff --git a/models.cpp b/models.cpp index a07a8a85..f3c0d6cc 100644 --- a/models.cpp +++ b/models.cpp @@ -281,7 +281,9 @@ EX namespace models { if(spiral_id > isize(torus_zeros)) spiral_id = 0; dialog::editNumber(spiral_id, 0, isize(torus_zeros)-1, 1, 10, XLAT("match the period of the torus"), ""); dialog::reaction = [] () { - tie(spiral_x, spiral_y) = torus_zeros[spiral_id]; + auto& co = torus_zeros[spiral_id]; + spiral_x = co.first; + spiral_y = co.second; }; dialog::bound_low(0); dialog::bound_up(isize(torus_zeros)-1); diff --git a/pattern2.cpp b/pattern2.cpp index 11005a9d..80da72a1 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -36,8 +36,8 @@ int gp_threecolor() { } int eupattern(cell *c) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; if(a4) return ((x&1) + 2*(y&1)) % 3; else @@ -45,8 +45,8 @@ int eupattern(cell *c) { } int eupattern4(cell *c) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; return (x&1) + ((y&1)) * 2; } @@ -108,8 +108,8 @@ unsigned bitmajority(unsigned a, unsigned b, unsigned c) { } int eufifty(cell *c) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; int ix = x + 99999 + y; int iy = y + 99999; if(c->land == laWildWest) @@ -1542,8 +1542,8 @@ EX namespace patterns { ep.extra_params["h2"] = getHemisphere(c, 2); } if(euclid) { - int x, y; - tie(x,y) = euc2_coordinates(c); + auto co = euc2_coordinates(c); + int x = co.first, y = co.second; ep.extra_params["ex"] = x; ep.extra_params["ey"] = y; if(S7 == 6) ep.extra_params["ez"] = -x-y;