collect_coords() revisited

Make recently added collect_coords() global even though it is still
only being used in teleport.c.

Add CC_SKIP_INACCS flag to only collect accessible locations so that
there's no need for a custom filter callback or of collecting spots
that will always be rejected when put to use.  Caller needs to check
Passes_walls/passes_walls() to decide whether that is suitable.

Merge some of the old safe_teleds() with the new, making it try
randomly 40 times before collecting coordinates for an exhaustive
selection.  Prior to the recent change which added collect_coords()
it was trying 400 times and giving up if that didn't find a good spot.

Start using collect_coords() for rloc() as well as for safe_teleds().
Only try to pick a spot randomly 50 times now instead of 1000.  If
those all fail, it does an exhaustive search of a randomized list of
candidates instead of old left-to-right, top-to-bottom map traversal.
Has not had nearly as much testing as safe_teleds() underwent.

rloc() was explicilty ignoring map column 1 for some reason.  Unlike
reserved column 0, column 1 is part of every level and should be
considered for monster teleport destination even though most levels
don't utilize it.
This commit is contained in:
PatR
2023-05-17 00:33:54 -07:00
parent d7f581d8ad
commit 49e93760a8
4 changed files with 97 additions and 78 deletions
+2
View File
@@ -1183,6 +1183,8 @@ with OPTIONS=blind (blind from birth), being inflicted with timed blinding
avoid sanity_check warning if statue in water or lava gets polymorphed into a
boulder; break it into a stack of rocks if that would happen
werewolf or werejackal howling and purple worm burping wakes up monsters
don't exclude map column 1 from consideration when rloc() picks a random spot
for destination of a teleported monster
Fixes to 3.7.0-x General Problems Exposed Via git Repository