From 9ce7a243ed2ada531a4a56a475d8b9544ed4fa98 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 4 Aug 2021 20:15:46 +0200 Subject: [PATCH] fixed switching messages --- attack.cpp | 10 +++++++--- pcmove.cpp | 5 ++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/attack.cpp b/attack.cpp index e8f73a54..688f1b05 100644 --- a/attack.cpp +++ b/attack.cpp @@ -1059,14 +1059,18 @@ EX bool should_switchplace(cell *c1, cell *c2) { if(isPrincess(c2->monst) || among(c2->monst, moGolem, moIllusion, moMouse, moFriendlyGhost)) return true; - if(peace::on) return c2->monst && !isMultitile(c2->monst); + if(peace::on) return c2->monst; return false; } -EX bool switchplace_prevent(cell *c1, cell *c2, bool checkonly) { +EX bool switchplace_prevent(cell *c1, cell *c2, struct pcmove& m) { if(!should_switchplace(c1, c2)) return false; + if(peace::on && (isMultitile(c2->monst) || saved_tortoise_on(c2) || isDie(c2->monst))) { + if(m.vmsg(miRESTRICTED)) addMessage(XLAT("Cannot switch places with %the1!", c2->monst)); + return true; + } if(c1->monst && c1->monst != moFriendlyIvy) { - if(!checkonly) addMessage(XLAT("There is no room for %the1!", c2->monst)); + if(m.vmsg(miRESTRICTED)) addMessage(XLAT("There is no room for %the1!", c2->monst)); return true; } if(passable(c1, c2, P_ISFRIEND | (c2->monst == moTameBomberbird ? P_FLYING : 0))) return false; diff --git a/pcmove.cpp b/pcmove.cpp index 7c8432f9..6a90a257 100644 --- a/pcmove.cpp +++ b/pcmove.cpp @@ -893,8 +893,7 @@ bool pcmove::after_escape() { #endif return false; } - else if(c2->monst && (!isFriendly(c2) || c2->monst == moTameBomberbird || isMountable(c2->monst)) - && !(peace::on && !isMultitile(c2->monst) && !good_tortoise)) + else if(c2->monst && (!isFriendly(c2) || c2->monst == moTameBomberbird || isMountable(c2->monst)) && !(peace::on && !good_tortoise)) return attack(); else if(!passable(c2, cwt.at, P_USEBOAT | P_ISPLAYER | P_MIRROR | P_MONSTER)) { tell_why_impassable(); @@ -925,7 +924,7 @@ bool pcmove::move_if_okay() { return false; } - if(switchplace_prevent(cwt.at, c2, checkonly)) + if(switchplace_prevent(cwt.at, c2, *this)) return false; if(!checkonly && warningprotection_hit(do_we_stab_a_friend(mi, moPlayer))) return false;