summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-place.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-29 16:18:54 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-29 16:26:52 +0100
commit48157817a3053124da32ae14442e0709806396a7 (patch)
treed1456f0daa9bf7de02526860418141ed5c075915 /crawl-ref/source/mon-place.h
parentf5005bf1b3b41ef64e857ceb56d8e2cdecb0fb65 (diff)
downloadcrawl-ref-48157817a3053124da32ae14442e0709806396a7.tar.gz
crawl-ref-48157817a3053124da32ae14442e0709806396a7.zip
Simplify find_newmons_square(), make it not crash.
After the first failure, it kept calling find_newmons_square_near() (and that in turn radius_iterator) with an invalid starting spot which would then always fail. Passing the monster that's to be checked for clouds to inside functions removes the need to make many random tries.
Diffstat (limited to 'crawl-ref/source/mon-place.h')
-rw-r--r--crawl-ref/source/mon-place.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/crawl-ref/source/mon-place.h b/crawl-ref/source/mon-place.h
index a40e5aaa8d..be88b910a5 100644
--- a/crawl-ref/source/mon-place.h
+++ b/crawl-ref/source/mon-place.h
@@ -65,7 +65,8 @@ conduct_type player_will_anger_monster(monster* mon);
bool player_angers_monster(monster* mon);
bool find_habitable_spot_near(const coord_def& where, monster_type mon_type,
- int radius, bool allow_centre, coord_def& empty);
+ int radius, bool allow_centre, coord_def& empty,
+ const monster* viable_mon = nullptr);
monster_type summon_any_demon(monster_type dct);
@@ -87,7 +88,8 @@ bool monster_habitable_grid(
int flies = -1,
bool paralysed = false);
bool monster_can_submerge(const monster* mon, dungeon_feature_type grid);
-coord_def find_newmons_square(monster_type mons_class, const coord_def &p);
+coord_def find_newmons_square(monster_type mons_class, const coord_def &p,
+ const monster* viable_mon = nullptr);
coord_def find_newmons_square_contiguous(monster_type mons_class,
const coord_def &start,
int maxdistance = 3);