From 0323e4100e20e0bcb6cfc25fbd7f5a885fb6bef0 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 8 Apr 2024 00:45:03 +0200 Subject: [PATCH] fixed the key being generated on ivy --- mapeffects.cpp | 29 +++++++++++++++++++---------- yendor.cpp | 5 ++++- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/mapeffects.cpp b/mapeffects.cpp index 16acc931..7b9b82b2 100644 --- a/mapeffects.cpp +++ b/mapeffects.cpp @@ -745,18 +745,27 @@ EX void checkTide(cell *c) { #endif } -EX bool makeEmpty(cell *c) { +EX bool makeNoMonster(cell *c) { + changes.ccell(c); + if(isAnyIvy(c->monst)) killMonster(c, moPlayer, 0); + else if(c->monst == moPair) { + changes.ccell(c->move(c->mondir)); + if(c->move(c->mondir)->monst == moPair) + c->move(c->mondir)->monst = moNone; + } + else if(isWorm(c->monst)) { + if(!items[itOrbDomination]) return false; + } + else if(isMultitile(c->monst)) { + return false; + } + else c->monst = moNone; + return true; + } +EX bool makeEmpty(cell *c) { if(c->monst != moPrincess) { - if(isAnyIvy(c->monst)) killMonster(c, moPlayer, 0); - else if(c->monst == moPair) { - if(c->move(c->mondir)->monst == moPair) - c->move(c->mondir)->monst = moNone; - } - else if(isWorm(c->monst)) { - if(!items[itOrbDomination]) return false; - } - else c->monst = moNone; + if(!makeNoMonster(c)) return false; } if(c->land == laCanvas) ; diff --git a/yendor.cpp b/yendor.cpp index ba1bb117..8046ea0a 100644 --- a/yendor.cpp +++ b/yendor.cpp @@ -278,10 +278,12 @@ EX namespace yendor { goto retry; } + auto rollbacks = std::move(changes.rollbacks); for(int i=-1; itype; i++) { cell *c2 = i >= 0 ? key->move(i) : key; checkTide(c2); - c2->monst = moNone; c2->item = itNone; + makeNoMonster(c2); + c2->item = itNone; if(!passable(c2, NULL, P_MIRROR | P_MONSTER)) { if(c2->wall == waCavewall) c2->wall = waCavefloor; else if(c2->wall == waDeadwall) c2->wall = waDeadfloor2; @@ -311,6 +313,7 @@ EX namespace yendor { if(c2->land == laMirrorWall && i == -1) c2->wall = waNone; } + changes.rollbacks = std::move(rollbacks); key->item = itKey; bool split_found = false;