Separate permonst valid location humidity function
This commit is contained in:
@@ -218,12 +218,13 @@ enum opcode_defs {
|
||||
#define SP_COORD_IS_RANDOM 0x01000000
|
||||
/* Humidity flags for get_location() and friends, used with
|
||||
* SP_COORD_PACK_RANDOM() */
|
||||
#define DRY 0x1
|
||||
#define WET 0x2
|
||||
#define HOT 0x4
|
||||
#define SOLID 0x8
|
||||
#define ANY_LOC 0x10 /* even outside the level */
|
||||
#define DRY 0x01
|
||||
#define WET 0x02
|
||||
#define HOT 0x04
|
||||
#define SOLID 0x08
|
||||
#define ANY_LOC 0x10 /* even outside the level */
|
||||
#define NO_LOC_WARN 0x20 /* no complaints and set x & y to -1, if no loc */
|
||||
#define SPACELOC 0x40 /* like DRY, but accepts furniture too */
|
||||
|
||||
#define SP_COORD_X(l) (l & 0xff)
|
||||
#define SP_COORD_Y(l) ((l >> 16) & 0xff)
|
||||
|
||||
31
src/sp_lev.c
31
src/sp_lev.c
@@ -72,6 +72,7 @@ STATIC_DCL void FDECL(create_door, (room_door *, struct mkroom *));
|
||||
STATIC_DCL void FDECL(create_trap, (trap *, struct mkroom *));
|
||||
STATIC_DCL int FDECL(noncoalignment, (ALIGNTYP_P));
|
||||
STATIC_DCL boolean FDECL(m_bad_boulder_spot, (int, int));
|
||||
STATIC_DCL int FDECL(pm_to_humidity, (struct permonst *));
|
||||
STATIC_DCL void FDECL(create_monster, (monster *, struct mkroom *));
|
||||
STATIC_DCL void FDECL(create_object, (object *, struct mkroom *));
|
||||
STATIC_DCL void FDECL(create_altar, (altar *, struct mkroom *));
|
||||
@@ -895,6 +896,8 @@ register int humidity;
|
||||
|| typ == CORR)
|
||||
return TRUE;
|
||||
}
|
||||
if ((humidity & SPACELOC) && SPACE_POS(levl[x][y].typ))
|
||||
return TRUE;
|
||||
if ((humidity & WET) && is_pool(x, y))
|
||||
return TRUE;
|
||||
if ((humidity & HOT) && is_lava(x, y))
|
||||
@@ -1495,6 +1498,24 @@ int x, y;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
STATIC_OVL int
|
||||
pm_to_humidity(pm)
|
||||
struct permonst *pm;
|
||||
{
|
||||
int loc = DRY;
|
||||
if (!pm)
|
||||
return loc;
|
||||
if (pm->mlet == S_EEL || amphibious(pm) || is_swimmer(pm))
|
||||
loc = WET;
|
||||
if (is_flyer(pm) || is_floater(pm))
|
||||
loc |= (HOT | WET);
|
||||
if (passes_walls(pm) || noncorporeal(pm))
|
||||
loc |= SOLID;
|
||||
if (flaming(pm))
|
||||
loc |= HOT;
|
||||
return loc;
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
create_monster(m, croom)
|
||||
monster *m;
|
||||
@@ -1543,15 +1564,7 @@ struct mkroom *croom;
|
||||
pm = (struct permonst *) 0;
|
||||
|
||||
if (pm) {
|
||||
int loc = DRY;
|
||||
if (pm->mlet == S_EEL || amphibious(pm) || is_swimmer(pm))
|
||||
loc = WET;
|
||||
if (is_flyer(pm) || is_floater(pm))
|
||||
loc |= (HOT | WET);
|
||||
if (passes_walls(pm) || noncorporeal(pm))
|
||||
loc |= SOLID;
|
||||
if (flaming(pm))
|
||||
loc |= HOT;
|
||||
int loc = pm_to_humidity(pm);
|
||||
/* If water-liking monster, first try is without DRY */
|
||||
get_location_coord(&x, &y, loc | NO_LOC_WARN, croom, m->coord);
|
||||
if (x == -1 && y == -1) {
|
||||
|
||||
Reference in New Issue
Block a user