From 661743a19b1afcc42eb3a936fe619c661ac4984a Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 9 Aug 2019 14:29:08 +0200 Subject: [PATCH] removed the obsolete *MovR functions --- bigstuff.cpp | 10 +++++----- cell.cpp | 10 ---------- game.cpp | 2 +- hyper.h | 2 -- landgen.cpp | 12 ++++++------ shmup.cpp | 14 +++++++------- 6 files changed, 19 insertions(+), 31 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index ba5e36ca..96cec772 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -289,14 +289,14 @@ void generateTreasureIsland(cell *c) { qlo = i; qhi = i; while(true && qc < MAX_EDGE) { qlo--; - c2 = createMovR(c, qlo); + c2 = c->cmodmove(qlo); if(!eubinary && !c2->master->alt) break; if(celldistAlt(c2) >= celldistAlt(c)) break; ctab[qc++] = c2; } while(true && qc < MAX_EDGE) { qhi++; - c2 = createMovR(c, qhi); + c2 = c->cmodmove(qhi); if(!eubinary && !c2->master->alt) break; if(celldistAlt(c2) >= celldistAlt(c)) break; ctab[qc++] = c2; @@ -310,7 +310,7 @@ void generateTreasureIsland(cell *c) { printf("vs %d\n", celldistAlt(c)); return; } - cell* c2 = createMovR(c, (qlo+qhi)/2); + cell* c2 = c->cmodmove((qlo+qhi)/2); generateTreasureIsland(c2); if(!src) { c->wall = c2->wall; @@ -553,7 +553,7 @@ void buildEquidistant(cell *c) { int q = (bsid+j+42) % c2->type; cell *c3 = c2->move(q); if(coastval(c3, b) < mcv) { - cell *c4 = createMovR(c2, bsid+1); + cell *c4 = c2->cmodmove(bsid+1); if(c4->land == laNone && c2->mpdist <= BARLEV) setdist(c4, BARLEV, c2); buildEquidistant(c4); mcv2 = coastval(c4, b); @@ -562,7 +562,7 @@ void buildEquidistant(cell *c) { q = (bsid-j+MODFIXER) % c2->type; c3 = c2->move(q); if(coastval(c3, b) < mcv) { - cell *c4 = createMovR(c2, bsid-1); + cell *c4 = c2->cmodmove(bsid-1); if(c4->land == laNone && c2->mpdist <= BARLEV) setdist(c4, BARLEV, c2); buildEquidistant(c4); mcv2 = coastval(c4, b); diff --git a/cell.cpp b/cell.cpp index 2df610a0..5854c9a0 100644 --- a/cell.cpp +++ b/cell.cpp @@ -161,16 +161,6 @@ cell *createMov(cell *c, int d) { return c->move(d); } -cell *createMovR(cell *c, int d) { - d %= MODFIXER; d += MODFIXER; d %= c->type; - return createMov(c, d); - } - -cell *getMovR(cell *c, int d) { - d %= MODFIXER; d += MODFIXER; d %= c->type; - return c->move(d); - } - void eumerge(cell* c1, int s1, cell *c2, int s2, bool mirror) { if(!c2) return; c1->move(s1) = c2; c1->c.setspin(s1, s2, mirror); diff --git a/game.cpp b/game.cpp index 770885ba..080d1dfb 100644 --- a/game.cpp +++ b/game.cpp @@ -5275,7 +5275,7 @@ void sideAttack(cell *mf, int dir, eMonster who, int bonus, eItem orb) { if(!items[orb]) return; if(who != moPlayer && !items[itOrbEmpathy]) return; for(int k: {-1, 1}) { - cell *mt = getMovR(mf, dir + k*bonus); + cell *mt = mf->modmove(dir + k*bonus); eMonster m = mt->monst; flagtype f = AF_SIDE; if(items[itOrbSlaying]) f|= AF_CRUSH; diff --git a/hyper.h b/hyper.h index e6e7102e..3b939709 100644 --- a/hyper.h +++ b/hyper.h @@ -3184,8 +3184,6 @@ namespace princess { int eudist(int sx, int sy); -cell *createMovR(cell *c, int d); - bool ishept(cell *c); int cdist50(cell *c); bool polarb50(cell *c); diff --git a/landgen.cpp b/landgen.cpp index fd6c76a7..825e5b9f 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -1736,15 +1736,15 @@ void giantLandSwitch(cell *c, int d, cell *from) { } else if(ishept(c) && hrand(100) < (doCross?20:8) && !c->monst) { buildRedWall(c, 80); - int i = hrand(S7); - buildRedWall(createMovR(c, i), 33); + cellwalker cw(c, hrand(S7)); + buildRedWall(cw.cpeek(), 33); if(hrand(2) == 0) - buildRedWall(createMovR(createMovR(c, i), c->c.spin(i)+(hrand(2)?2:4)), 20); - i = (i + 3 + hrand(2)) % S7; + buildRedWall((cw + wstep + (hrand(2)?2:4)).cpeek(), 20); + cw += rev; if(hrand(6) < 4) - buildRedWall(createMovR(c, i), 33); + buildRedWall(cw.cpeek(), 33); if(hrand(2) == 0) - buildRedWall(createMovR(createMovR(c, i), c->c.spin(i)+(hrand(2)?2:4)), 20); + buildRedWall((cw + wstep + (hrand(2)?2:4)).cpeek(), 20); } } if(d == 7 && c->wall == waNone) diff --git a/shmup.cpp b/shmup.cpp index d45348ad..79ee73e8 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -1946,7 +1946,7 @@ void movePlayer(monster *m, int delta) { double bestd = 9999; pushmonsters(); for(int di=-1; di<2; di+=2) { - cell *c = getMovR(c2, sd+di); + cell *c = c2->modmove(sd+di); if(!c) continue; if(m->isVirtual || !gmatrix.count(c)) continue; double d = intval(gmatrix[c] * C0, m->pat * C0); @@ -2227,8 +2227,8 @@ int reflect(cell*& c2, cell*& mbase, transmatrix& nat) { int d = mirror::mirrordir(c2); if(d != -1) { for(int k=0; k<7; k++) { - cell *ca = createMovR(c2, d-k); - cell *cb = createMovR(c2, d+k); + cell *ca = c2->cmodmove(d-k); + cell *cb = c2->cmodmove(d+k); if(ca->land == laMirror && inmirror(cb)) { reflectmatrix(nat, ca, cb, true); reflections++; @@ -2238,11 +2238,11 @@ int reflect(cell*& c2, cell*& mbase, transmatrix& nat) { } else { for(int k=0; k<6; k++) { - cell *cb = createMovR(c2, k+1); - cell *cc = createMovR(c2, k+2); + cell *cb = c2->cmodmove(k+1); + cell *cc = c2->cmodmove(k+2); if(cb->land != laMirrorWall || cc->land != laMirrorWall) continue; - cell *ca = createMovR(c2, k); - cell *cd = createMovR(c2, k+3); + cell *ca = c2->cmodmove(k); + cell *cd = c2->cmodmove(k+3); if(reflectmatrix(nat, cc, ca, true)) reflections++; for(int limit=0; limit<10 && reflectmatrix(nat, cb, cd, true) && (reflections++, reflectmatrix(nat, cc, ca, true)); limit++) reflections+=2; }