summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 10:23:02 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-02 10:23:02 +0000
commite6584efd5c0dfe8d24d07ceca6db2d563d2b9cd9 (patch)
tree52667acedceaa9628e81005d4890d00f77285143 /crawl-ref/source/monstuff.cc
parent494a1b9c815b29c5ec622f3f3c9d58f809b5f2ad (diff)
downloadcrawl-ref-e6584efd5c0dfe8d24d07ceca6db2d563d2b9cd9.tar.gz
crawl-ref-e6584efd5c0dfe8d24d07ceca6db2d563d2b9cd9.zip
Oops, don't let pets swap or be swapped with other monsters if the
player explictly told them to attack monsters in spite of sanctuary. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6330 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index c6d2c1059d..7627b6e4f3 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5689,6 +5689,14 @@ static bool _swap_monsters(const int mover_idx, const int moved_idx)
return false;
}
+ // Don't swap places if the player explicitly ordered their pet
+ // to attack monsters.
+ if ((mons_friendly(mover) || mons_friendly(moved))
+ && you.pet_target != MHITYOU && you.pet_target != MHITNOT)
+ {
+ return false;
+ }
+
if (!mover->can_pass_through(moved->x, moved->y)
|| !moved->can_pass_through(mover->x, mover->y))
{