diff --git a/game.cpp b/game.cpp index de70ccd8..0343f13b 100644 --- a/game.cpp +++ b/game.cpp @@ -6369,29 +6369,30 @@ void placeItems(int qty, eItem it) { } } -cell *recallCell; +cellwalker recallCell; bool activateRecall() { - if(!recallCell) { + if(!recallCell.at) { addMessage("Error: no recall"); return false; } items[itOrbRecall] = 0; items[itOrbSafety] = 0; - if(!makeEmpty(recallCell)) { + if(!makeEmpty(recallCell.at)) { addMessage(XLAT("Your Orb of Recall is blocked by something big!")); - recallCell = NULL; + recallCell.at = NULL; return false; } killFriendlyIvy(); - movecost(cwt.at, recallCell, 3); - playerMoveEffects(cwt.at, recallCell); + movecost(cwt.at, recallCell.at, 3); + playerMoveEffects(cwt.at, recallCell.at); mirror::destroyAll(); sword::reset(); - cwt.at = recallCell; recallCell = NULL; - cwt.spin = hrand(cwt.at->type); flipplayer = !!(hrand(2)); + cwt = recallCell; + recallCell.at = NULL; + flipplayer = true; fullcenter(); makeEmpty(cwt.at); forCellEx(c2, cwt.at) @@ -6406,12 +6407,12 @@ bool activateRecall() { return true; } -void saveRecall(cell *c2) { - if(!recallCell) recallCell = c2; +void saveRecall(cellwalker cw2) { + if(!recallCell.at) recallCell = cw2; } void activateSafety(eLand l) { - if(recallCell && activateRecall()) + if(recallCell.at && activateRecall()) return; savePrincesses(); int gg = countMyGolems(moGolem); @@ -6514,7 +6515,7 @@ void checkmove() { items[itWarning]-=2; for(int i=0; iitem)) { eItem it = c2->item; - if(it == itOrbRecall) saveRecall(c2); + if(it == itOrbRecall) { + cellwalker cw2 = cwt; + cw2++; + cw2.at = c2; + saveRecall(cw2); + } if(it == itOrbFire) playSound(c2, "fire"); else if(it == itOrbFire) playSound(c2, "fire"); else if(it == itOrbWinter) playSound(c2, "pickup-winter"); diff --git a/hyper.h b/hyper.h index 62c1b23a..e37b26e9 100644 --- a/hyper.h +++ b/hyper.h @@ -2248,7 +2248,7 @@ int reptilemax(); extern bool mousing; #define IFM(x) (mousing?"":x) -extern cell *recallCell; +extern cellwalker recallCell; extern eLand cheatdest; void cheatMoveTo(eLand l); diff --git a/savemem.cpp b/savemem.cpp index 9ab2dfb9..c83e229f 100644 --- a/savemem.cpp +++ b/savemem.cpp @@ -92,9 +92,9 @@ void save_memory() { heptagon *at = cwt.at->master; heptagon *orig = currentmap->gamestart()->master; - if(recallCell) { - if(unsafeLand(recallCell)) return; - heptagon *at2 = recallCell->master; + if(recallCell.at) { + if(unsafeLand(recallCell.at)) return; + heptagon *at2 = recallCell.at->master; int t = 0; while(at != at2) { t++; if(t > 10000) return; diff --git a/shmup.cpp b/shmup.cpp index 66821cfd..17772eb8 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -3427,7 +3427,7 @@ void turn(int delta) { buildRosemap(); if(havewhat&HF_RIVER) prairie::move(); } - if(recallCell && !markOrb(itOrbRecall)) activateRecall(); + if(recallCell.at && !markOrb(itOrbRecall)) activateRecall(); save_memory(); } if(elec::havecharge) elec::act();