summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/teleport.cc
diff options
context:
space:
mode:
authorShmuale Mark <shm.mark@gmail.com>2014-07-02 12:55:58 -0400
committerShmuale Mark <shm.mark@gmail.com>2014-07-02 12:55:58 -0400
commit5b88333b5fe9f0142eddeabb356199521bb16d06 (patch)
tree46b561ed03c7fe9e5bbb2b4f7f84c9ad9ea3e9da /crawl-ref/source/teleport.cc
parenta39764ffcd1b290f1a1f0f961fbd1febff85f281 (diff)
downloadcrawl-ref-5b88333b5fe9f0142eddeabb356199521bb16d06.tar.gz
crawl-ref-5b88333b5fe9f0142eddeabb356199521bb16d06.zip
Improve behaviour on failure to monster teleport failure (#3839).
It's fairly easy to reproduce by wizmoding Zig:1 full of plants and then teleporting a monster in there: it will probably end up in a wall. As the mantis issue says, this will basically never happen in a real game, but if it were to do so, just keeping it in place (with an appropriate message seems like the best behaviour).
Diffstat (limited to 'crawl-ref/source/teleport.cc')
-rw-r--r--crawl-ref/source/teleport.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc
index 92e18e03ee..18a6dc0f79 100644
--- a/crawl-ref/source/teleport.cc
+++ b/crawl-ref/source/teleport.cc
@@ -303,16 +303,11 @@ void monster_teleport(monster* mons, bool instan, bool silent)
coord_def newpos;
- if (newpos.origin())
- _monster_random_space(mons, newpos, !mons->wont_attack());
-
- // XXX: If the above function didn't find a good spot, return now
- // rather than continue by slotting the monster (presumably)
- // back into its old location (previous behaviour). This seems
- // to be much cleaner and safer than relying on what appears to
- // have been a mistake.
- if (newpos.origin())
+ if (!_monster_random_space(mons, newpos, !mons->wont_attack()))
+ {
+ simple_monster_message(mons, " flickers for a moment.");
return;
+ }
if (!silent)
simple_monster_message(mons, " disappears!");