Fix priest generated inside temple wall

In a rare case, a random room's width can be 2 tiles, and if
that room was converted into a temple, the priest ended up
inside the wall. Try to put the priest on a random valid position
around the altar, or on it.
This commit is contained in:
Pasi Kallinen
2020-03-12 19:17:06 +02:00
parent a6c600fd61
commit 2ff8523481
4 changed files with 24 additions and 4 deletions
+1
View File
@@ -75,6 +75,7 @@ when punished, involuntarily teleporting and landing within chain range of
"remove_object: obj not on floor" panic on hero's next move "remove_object: obj not on floor" panic on hero's next move
inventory cursing caused by "this water's no good" effect when drinking from inventory cursing caused by "this water's no good" effect when drinking from
a fountain didn't update persistent inventory window a fountain didn't update persistent inventory window
fix priest created inside temple wall
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
+1
View File
@@ -2490,6 +2490,7 @@ E void FDECL(selection_free, (struct selectionvar *, BOOLEAN_P));
E void FDECL(set_selection_floodfillchk, (int FDECL((*), (int,int)))); E void FDECL(set_selection_floodfillchk, (int FDECL((*), (int,int))));
E void FDECL(selection_floodfill, (struct selectionvar *, int, int, E void FDECL(selection_floodfill, (struct selectionvar *, int, int,
BOOLEAN_P)); BOOLEAN_P));
E boolean FDECL(pm_good_location, (int, int, struct permonst *));
E void FDECL(get_location_coord, (schar *, schar *, int, struct mkroom *, E void FDECL(get_location_coord, (schar *, schar *, int, struct mkroom *,
long)); long));
E void FDECL(selection_setpoint, (int, int, struct selectionvar *, XCHAR_P)); E void FDECL(selection_setpoint, (int, int, struct selectionvar *, XCHAR_P));
+14 -4
View File
@@ -232,12 +232,22 @@ boolean sanctum; /* is it the seat of the high priest? */
struct monst *priest; struct monst *priest;
struct obj *otmp; struct obj *otmp;
int cnt; int cnt;
int px, py, i, si = rn2(8);
struct permonst *prim = &mons[sanctum ? PM_HIGH_PRIEST : PM_ALIGNED_PRIEST];
if (MON_AT(sx + 1, sy)) for (i = 0; i < 8; i++) {
(void) rloc(m_at(sx + 1, sy), FALSE); /* insurance */ px = sx + xdir[(i+si) % 8];
py = sy + ydir[(i+si) % 8];
if (pm_good_location(px, py, prim))
break;
}
if (i == 8)
px = sx, py = sy;
priest = makemon(&mons[sanctum ? PM_HIGH_PRIEST : PM_ALIGNED_PRIEST], if (MON_AT(px, py))
sx + 1, sy, MM_EPRI); (void) rloc(m_at(px, py), FALSE); /* insurance */
priest = makemon(prim, px, py, MM_EPRI);
if (priest) { if (priest) {
EPRI(priest)->shroom = (schar) ((sroom - g.rooms) + ROOMOFFSET); EPRI(priest)->shroom = (schar) ((sroom - g.rooms) + ROOMOFFSET);
EPRI(priest)->shralign = Amask2align(levl[sx][sy].altarmask); EPRI(priest)->shralign = Amask2align(levl[sx][sy].altarmask);
+8
View File
@@ -1084,6 +1084,14 @@ register int humidity;
return FALSE; return FALSE;
} }
boolean
pm_good_location(x, y, pm)
int x, y;
struct permonst *pm;
{
return is_ok_location(x, y, pm_to_humidity(pm));
}
static unpacked_coord static unpacked_coord
get_unpacked_coord(loc, defhumidity) get_unpacked_coord(loc, defhumidity)
long loc; long loc;