diff --git a/complex.cpp b/complex.cpp index ca4cff52..28645e03 100644 --- a/complex.cpp +++ b/complex.cpp @@ -144,7 +144,7 @@ EX namespace whirlwind { animateMovement(match(whirlline[i+1], whirlline[i]), LAYER_BOAT); } for(int i=0; iitem == itKey || wfrom->item == itOrbYendor) for(int i=0; itype; i++) createMov(wto, i); moveItem(wfrom, wto, false); - pickupMovedItems(wfrom); - pickupMovedItems(wto); + pickupMovedItems(wfrom, wto); + pickupMovedItems(wto, wfrom); } if(wto && !wfrom) @@ -2466,7 +2466,7 @@ EX void livecaves() { if(hv > 0 && c->wall == waNone) { if(c->item && c->cpdist == 1 && markOrb(itOrbWater)) { bool saf = c->item == itOrbSafety; - collectItem(c); + collectItem(c, c); if(saf) return; } c->wall = waSea; diff --git a/complex2.cpp b/complex2.cpp index 8ea494f3..f11c3dec 100644 --- a/complex2.cpp +++ b/complex2.cpp @@ -261,7 +261,7 @@ EX namespace westwall { animateMovement(match(whirlline[i+1], whirlline[i]), LAYER_BOAT); } for(int i=0; iitem == itOrbSafety) { - collectItem(pc, true); + collectItem(pc, pc, true); return; } diff --git a/inventory.cpp b/inventory.cpp index ed0af515..32c31ffb 100644 --- a/inventory.cpp +++ b/inventory.cpp @@ -661,7 +661,7 @@ EX namespace inv { eItem it = cwt.at->item; cwt.at->item = orbmap[uni]; inv::activating = true; - collectItem(cwt.at, true); + collectItem(cwt.at, cwt.at, true); inv::activating = false; addMessage(XLAT("You activate %the1.", orbmap[uni])); if(!cwt.at->item) usedup[orbmap[uni]]++; diff --git a/items.cpp b/items.cpp index 4717fa12..2158b074 100644 --- a/items.cpp +++ b/items.cpp @@ -57,23 +57,23 @@ EX bool doPickupItemsWithMagnetism(cell *c) { else if(c3->item == itOrbSafety || c3->item == itBuggy || c3->item == itBuggy2) csaf = c3; else if(markOrb(itOrbMagnetism)) - collectItem(c3, false); + collectItem(c3, c3, false); } if(csaf) - return collectItem(csaf, false); + return collectItem(csaf, csaf, false); return false; } -EX void pickupMovedItems(cell *c) { +EX void pickupMovedItems(cell *c, cell *from) { if(!c->item) return; if(c->item == itOrbSafety) return; - if(isPlayerOn(c)) collectItem(c, true); + if(isPlayerOn(c)) collectItem(c, from, true); if(items[itOrbMagnetism]) forCellEx(c2, c) if(isPlayerOn(c2) && canPickupItemWithMagnetism(c, c2)) { changes.ccell(c2); changes.ccell(c); - collectItem(c, true); + collectItem(c, c2, true); } } @@ -81,7 +81,7 @@ EX bool in_lovasz() { return specialland == laMotion && bounded && ls::single() && !daily::on; } -EX bool collectItem(cell *c2, bool telekinesis IS(false)) { +EX bool collectItem(cell *c2, cell *last, bool telekinesis IS(false)) { bool dopickup = true; bool had_choice = false; @@ -119,7 +119,7 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) { #endif if(isRevivalOrb(c2->item) && multi::revive_queue.size()) { - multiRevival(cwt.at, c2); + multiRevival(last, c2); } else if(isShmupLifeOrb(c2->item) && shmup::on) { playSound(c2, "pickup-orb"); // TODO summon @@ -165,12 +165,12 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) { } else if(c2->item == itOrbLife) { playSound(c2, "pickup-orb"); // TODO summon - placeGolem(cwt.at, c2, moGolem); + placeGolem(last, c2, moGolem); if(cwt.at->monst == moGolem) cwt.at->stuntime = 0; } else if(c2->item == itOrbFriend) { playSound(c2, "pickup-orb"); // TODO summon - placeGolem(cwt.at, c2, moTameBomberbird); + placeGolem(last, c2, moTameBomberbird); if(cwt.at->monst == moTameBomberbird) cwt.at->stuntime = 0; } #if CAP_TOUR @@ -209,7 +209,7 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) { changes.value_set(tortoise::seekbits, bnew); changes.value_set(tortoise::last, seekbits); if(seek()) { - cell *c = passable(cwt.at, NULL, 0) ? cwt.at : c2; + cell *c = passable(last, NULL, 0) ? last : c2; changes.ccell(c); c->item = itBabyTortoise; if(c == c2) dopickup = false; diff --git a/orbs.cpp b/orbs.cpp index 03881b2c..d35769f8 100644 --- a/orbs.cpp +++ b/orbs.cpp @@ -695,7 +695,7 @@ EX bool jumpTo(orbAction a, cell *dest, eItem byWhat, int bonuskill IS(0), eMons from = NULL; } if(cwt.at->item != itOrbYendor && cwt.at->item != itHolyGrail) { - auto c = collectItem(cwt.at, true); + auto c = collectItem(cwt.at, from, true); if(c) { return true; } @@ -777,7 +777,7 @@ void telekinesis(cell *dest) { } moveItem(dest, cwt.at, true); - collectItem(cwt.at, true); + collectItem(cwt.at, cwt.at, true); useupOrb(itOrbSpace, cost.first); if(cost.second) markOrb(itOrbMagnetism); diff --git a/pcmove.cpp b/pcmove.cpp index 2eed8ef3..bcc854f9 100644 --- a/pcmove.cpp +++ b/pcmove.cpp @@ -1147,11 +1147,11 @@ bool pcmove::perform_actual_move() { movecost(cwt.at, c2, 1); - if(!boatmove && collectItem(c2)) return true; + if(!boatmove && collectItem(c2, cwt.at)) return true; if(boatmove && c2->item && cwt.at->item) { eItem it = c2->item; c2->item = cwt.at->item; - if(collectItem(c2)) return true; + if(collectItem(c2, cwt.at)) return true; eItem it2 = c2->item; c2->item = it; cwt.at->item = it2; @@ -1167,7 +1167,7 @@ bool pcmove::perform_actual_move() { forCellEx(c3, c2) if(c3->wall == waIcewall && c3->item) { changes.ccell(c3); markOrb(itOrbWinter); - if(collectItem(c3)) return true; + if(collectItem(c3, cwt.at)) return true; } movecost(cwt.at, c2, 2); diff --git a/shmup.cpp b/shmup.cpp index fa62a65a..c26eb158 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -1098,7 +1098,7 @@ void movePlayer(monster *m, int delta) { } else if(m->inBoat && !isWateryOrBoat(c2) && passable(c2, m->base, P_ISPLAYER | P_MIRROR | reflectflag)) { if(boatGoesThrough(c2) && markOrb(itOrbWater)) { - collectItem(c2); + collectItem(c2, m->base); c2->wall = isIcyLand(m->base) ? waLake : waSea; } else { @@ -1249,7 +1249,7 @@ void movePlayer(monster *m, int delta) { } if(c2->item == itOrbYendor && !peace::on) yendor::check(c2); - collectItem(c2); + collectItem(c2, m->base); movecost(m->base, c2, 2); } }