diff --git a/cell.cpp b/cell.cpp index ecdb5334..b70b5157 100644 --- a/cell.cpp +++ b/cell.cpp @@ -462,11 +462,6 @@ EX int celldistAlt(cell *c) { return mi; } -EX int dirfromto(cell *cfrom, cell *cto) { - for(int i=0; itype; i++) if(cfrom->move(i) == cto) return i; - return -1; - } - #if HDR static const int RPV_MODULO = 5; static const int RPV_RAND = 0; diff --git a/game.cpp b/game.cpp index 1e34bfbc..dd9676fb 100644 --- a/game.cpp +++ b/game.cpp @@ -835,7 +835,7 @@ bool ghostmove(eMonster m, cell* to, cell* from) { bool slimepassable(cell *w, cell *c) { if(w == c || !c) return true; - int u = dirfromto(c, w); + int u = neighborId(c, w); if(nonAdjacent(w,c)) return false; if(isPlayerOn(w)) return true; int group = slimegroup(c); diff --git a/hyper.h b/hyper.h index 2cd7caef..dca0a54d 100644 --- a/hyper.h +++ b/hyper.h @@ -849,8 +849,6 @@ namespace mirror { void act(int dir, int flags); } -int neighborId(cell *c1, cell *c2); - struct movedir { int d; // non-negative numbers denote 'rotate +d steps and act in this direction diff --git a/shmup.cpp b/shmup.cpp index 64a28a48..63ef771e 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -1032,7 +1032,7 @@ void movePlayer(monster *m, int delta) { } else { if(isWatery(m->base)) - m->base->wall = waBoat, m->base->mondir = dirfromto(m->base, c2); + m->base->wall = waBoat, m->base->mondir = neighborId(m->base, c2); else if(boatStrandable(m->base)) m->base->wall = waStrandedBoat; else if(boatStrandable(c2)) @@ -1041,7 +1041,7 @@ void movePlayer(monster *m, int delta) { } } else if(isPushable(c2->wall) && !nonAdjacent(c2, m->base)) { - int sd = dirfromto(c2, m->base); + int sd = neighborId(c2, m->base); int subdir = 1; double bestd = 9999; pushmonsters(); @@ -1053,7 +1053,7 @@ void movePlayer(monster *m, int delta) { if(dbase)); + cellwalker push(c2, neighborId(c2, m->base)); push = push + 3 * (-subdir) + wstep; if(!canPushThumperOn(push.at, c2, m->base) && c2->type == 7) { push = push + wstep - subdir + wstep; @@ -1109,7 +1109,7 @@ void movePlayer(monster *m, int delta) { if(items[itOrbDigging]) { visibleFor(400); - int d = dirfromto(m->base, c2); + int d = neighborId(m->base, c2); if(d >= 0 && earthMove(m->base, d)) markOrb(itOrbDigging); } @@ -2171,7 +2171,7 @@ void moveMonster(monster *m, int delta) { if(c2 != m->base && m->type == moFireElemental) makeflame(m->base, 20, false); if(c2 != m->base && m->type == moWaterElemental) placeWater(c2, m->base); if(c2 != m->base && m->type == moEarthElemental) { - int d = dirfromto(m->base, c2); + int d = neighborId(m->base, c2); if(d >= 0) earthMove(m->base, d); } @@ -2194,7 +2194,7 @@ void moveMonster(monster *m, int delta) { if(c2 != m->base && m->type == moNecromancer && !c2->monst) { for(int i=0; ibase->type; i++) { cell *c3 = m->base->move(i); - if(dirfromto(c3, c2) != -1 && c3->wall == waFreshGrave && gmatrix.count(c3)) { + if(neighborId(c3, c2) != -1 && c3->wall == waFreshGrave && gmatrix.count(c3)) { bool monstersNear = false; for(monster *m2: nonvirtual) { if(m2 != m && intval(m2->pat*C0, gmatrix[c3]*C0) < SCALE2 * .3) @@ -2251,7 +2251,7 @@ void moveMonster(monster *m, int delta) { } if(passable_for(m->type, c2, m->base, P_CHAIN | P_ONPLAYER | reflectflag) && !isWatery(c2) && m->inBoat) { if(isWatery(m->base)) - m->base->wall = waBoat, m->base->mondir = dirfromto(m->base, c2); + m->base->wall = waBoat, m->base->mondir = neighborId(m->base, c2); else if(boatStrandable(c2)) c2->wall = waStrandedBoat; else if(boatStrandable(m->base)) m->base->wall = waStrandedBoat; m->inBoat = false;