summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-pick.cc
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-01-31 17:02:27 -0500
committerNeil Moore <neil@s-z.org>2014-01-31 17:02:27 -0500
commit6b7c0aeb27b51a533c8c05fdf67eedb7147a092d (patch)
tree43857d0af1934b209254c42d13d21acdcf637ee8 /crawl-ref/source/mon-pick.cc
parentd820172923c9fe82ef3effb182b85d273aa3385c (diff)
downloadcrawl-ref-6b7c0aeb27b51a533c8c05fdf67eedb7147a092d.tar.gz
crawl-ref-6b7c0aeb27b51a533c8c05fdf67eedb7147a092d.zip
Don't crash when checking veto of MONS_NO_MONSTER (gammafunk)
Now pick_monster with a veto function rejects invalid monster types, including the MONS_NO_MONSTER introduced in 0.14-a0-2238-g1766415 and later to dilute monster spawning. Ordinary spawns without the veto are unaffected. This fixes a crash with "place:Shoals:3 zombie", and casting Shadow Creatures in Shoals etc.
Diffstat (limited to 'crawl-ref/source/mon-pick.cc')
-rw-r--r--crawl-ref/source/mon-pick.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/crawl-ref/source/mon-pick.cc b/crawl-ref/source/mon-pick.cc
index 29fb6e724b..2cc472a8e2 100644
--- a/crawl-ref/source/mon-pick.cc
+++ b/crawl-ref/source/mon-pick.cc
@@ -136,7 +136,7 @@ monster_type monster_picker::pick_with_veto(const pop_entry *weights,
// stored veto function. Can subclass further for more complex veto behaviour.
bool monster_picker::veto(monster_type mon)
{
- return _veto && _veto(mon);
+ return _veto && (invalid_monster_type(mon) || _veto(mon));
}
bool positioned_monster_picker::veto(monster_type mon)