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.
54 KiB
54 KiB