fixed switching messages

This commit is contained in:
Zeno Rogue 2021-08-04 20:15:46 +02:00
parent d98c8a025f
commit 9ce7a243ed
2 changed files with 9 additions and 6 deletions

View File

@ -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;

View File

@ -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;