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:
@@ -1206,6 +1206,16 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */
|
||||
#define CORPSTAT_MALE 2
|
||||
#define CORPSTAT_NEUTER 3
|
||||
|
||||
/* flag bits for collect_coords(); combining ring_pairs with unshuffled
|
||||
makes no sense--if both are specified unshuffled takes precedence */
|
||||
#define CC_NO_FLAGS 0x00 /* skip center, collect in distinct rings and
|
||||
* shuffle each ring, ignore monster occupants */
|
||||
#define CC_INCL_CENTER 0x01 /* include center point as ring #0 */
|
||||
#define CC_UNSHUFFLED 0x02 /* don't shuffle the rings */
|
||||
#define CC_RING_PAIRS 0x04 /* shuffle w/ odd and next even rings together */
|
||||
#define CC_SKIP_MONS 0x08 /* skip locations occupied by monsters */
|
||||
#define CC_SKIP_INACCS 0x10 /* skip !ACCESSIBLE: rock and wall locations */
|
||||
|
||||
/* flags for decide_to_shift() */
|
||||
#define SHIFT_SEENMSG 0x01 /* put out a message if in sight */
|
||||
#define SHIFT_MSG 0x02 /* always put out a message */
|
||||
|
||||
Reference in New Issue
Block a user