Merge branch 'pr794' into NetHack-3.7

This commit is contained in:
nhmall
2022-06-09 00:36:57 -04:00
2 changed files with 28 additions and 21 deletions
+1
View File
@@ -1830,6 +1830,7 @@ more cases where newcham() gives messages (pr #775 by copperwater)
lua: instance cleanup should not be applied to classes (by ToxicFrog) lua: instance cleanup should not be applied to classes (by ToxicFrog)
fix memory leaks related to selection_new() (pr #782 by argrath) fix memory leaks related to selection_new() (pr #782 by argrath)
wished-for doors in wizmode always vertical (pr #788 by entrez) wished-for doors in wizmode always vertical (pr #788 by entrez)
vampire shapeshifting in a door (pr #794 by entrez)
Code Cleanup and Reorganization Code Cleanup and Reorganization
+15 -9
View File
@@ -2494,7 +2494,7 @@ lifesaved_monster(struct monst* mtmp)
DISABLE_WARNING_FORMAT_NONLITERAL DISABLE_WARNING_FORMAT_NONLITERAL
void void
mondead(register struct monst* mtmp) mondead(struct monst *mtmp)
{ {
struct permonst *mptr; struct permonst *mptr;
boolean be_sad; boolean be_sad;
@@ -2516,13 +2516,11 @@ mondead(register struct monst* mtmp)
&& !(g.mvitals[mndx].mvflags & G_GENOD)) { && !(g.mvitals[mndx].mvflags & G_GENOD)) {
coord new_xy; coord new_xy;
char buf[BUFSZ]; char buf[BUFSZ];
boolean in_door = (amorphous(mtmp->data)
&& closed_door(mtmp->mx, mtmp->my)),
/* alternate message phrasing for some monster types */ /* alternate message phrasing for some monster types */
spec_mon = (nonliving(mtmp->data) boolean spec_mon = (nonliving(mtmp->data)
|| noncorporeal(mtmp->data) || noncorporeal(mtmp->data)
|| amorphous(mtmp->data)), || amorphous(mtmp->data)),
spec_death = (g.disintegested /* disintegrated or digested */ spec_death = (g.disintegested /* disintegrated/digested */
|| noncorporeal(mtmp->data) || noncorporeal(mtmp->data)
|| amorphous(mtmp->data)); || amorphous(mtmp->data));
int x = mtmp->mx, y = mtmp->my; int x = mtmp->mx, y = mtmp->my;
@@ -2546,7 +2544,9 @@ mondead(register struct monst* mtmp)
else else
uunstick(); uunstick();
} }
if (in_door) { /* if fog cloud is on a closed door space, move it to a more
appropriate spot for its intended new form */
if (amorphous(mtmp->data) && closed_door(mtmp->mx, mtmp->my)) {
if (enexto(&new_xy, mtmp->mx, mtmp->my, &mons[mndx])) if (enexto(&new_xy, mtmp->mx, mtmp->my, &mons[mndx]))
rloc_to(mtmp, new_xy.x, new_xy.y); rloc_to(mtmp, new_xy.x, new_xy.y);
} }
@@ -3230,8 +3230,6 @@ vamp_stone(struct monst* mtmp)
if (mndx >= LOW_PM && mndx != monsndx(mtmp->data) if (mndx >= LOW_PM && mndx != monsndx(mtmp->data)
&& !(g.mvitals[mndx].mvflags & G_GENOD)) { && !(g.mvitals[mndx].mvflags & G_GENOD)) {
char buf[BUFSZ]; char buf[BUFSZ];
boolean in_door = (amorphous(mtmp->data)
&& closed_door(mtmp->mx, mtmp->my));
/* construct a format string before transformation */ /* construct a format string before transformation */
Sprintf(buf, "The lapidifying %s %s %s", Sprintf(buf, "The lapidifying %s %s %s",
@@ -3249,7 +3247,7 @@ vamp_stone(struct monst* mtmp)
/* this can happen if previously a fog cloud */ /* this can happen if previously a fog cloud */
if (engulfing_u(mtmp)) if (engulfing_u(mtmp))
expels(mtmp, mtmp->data, FALSE); expels(mtmp, mtmp->data, FALSE);
if (in_door) { if (amorphous(mtmp->data) && closed_door(mtmp->mx, mtmp->my)) {
coord new_xy; coord new_xy;
if (enexto(&new_xy, mtmp->mx, mtmp->my, &mons[mndx])) { if (enexto(&new_xy, mtmp->mx, mtmp->my, &mons[mndx])) {
@@ -4123,6 +4121,14 @@ decide_to_shapeshift(struct monst* mon, int shiftflags)
dochng = (ptr != mon->data); dochng = (ptr != mon->data);
} }
} }
if (dochng && amorphous(mon->data)
&& closed_door(mon->mx, mon->my)) {
coord new_xy;
if (enexto(&new_xy, mon->mx, mon->my, ptr)) {
rloc_to(mon, new_xy.x, new_xy.y);
}
}
} else { } else {
if (mon->mhp >= 9 * mon->mhpmax / 10 && !rn2(6) if (mon->mhp >= 9 * mon->mhpmax / 10 && !rn2(6)
&& (!canseemon(mon) && (!canseemon(mon)