1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-05-12 02:05:22 +01:00

Razorvine bugfix: Don't put razorvines in walls or on other terain where they shouldn't be

This commit is contained in:
Chris-plus-alphanumericgibberish 2015-03-30 18:14:18 -04:00
parent b39963d7a3
commit fa68c054ee
3 changed files with 25 additions and 2 deletions

View file

@ -172,6 +172,7 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
#define MM_IGNOREWATER 0x80 /* ignore water when positioning */
#define MM_ADJACENTOK 0x100 /* it is acceptable to use adjacent coordinates */
#define MM_ADJACENTSTRICT 0x200 /* ...but only ONE removed.*/
#define MM_CHECK_GOODPOS 0x400 /* Don't create a monster where it shouldn't be.*/
/* special mhpmax value when loading bones monster to flag as extinct or genocided */
#define DEFUNCT_MONSTER (-100)

View file

@ -2593,7 +2593,29 @@ register int mmflags;
} else
return((struct monst *) 0);
}
if(ptr && mmflags & MM_CHECK_GOODPOS){
struct monst fakemon;
fakemon.data = ptr; /* set up for goodpos */
if(!goodpos(x, y, &fakemon, gpflags)){
if ((mmflags & MM_ADJACENTOK) != 0) {
coord bypos;
if(enexto_core(&bypos, x, y, ptr, gpflags)) {
if( !(mmflags & MM_ADJACENTSTRICT) || (
bypos.x - x <= 1 && bypos.x - x >= -1 &&
bypos.y - y <= 1 && bypos.y - y >= -1
)){
x = bypos.x;
y = bypos.y;
}
else return((struct monst *) 0);
} else
return((struct monst *) 0);
} else
return((struct monst *) 0);
}
}
if(ptr){
mndx = monsndx(ptr);
/* if you are to make a specific monster and it has

View file

@ -930,7 +930,7 @@ movemon()
!rn2(4)
){
struct monst *sprout = (struct monst *) 0;
sprout = makemon(mtmp->data,(mtmp->mx-1)+rn2(3),(mtmp->my-1)+rn2(3),MM_NOCOUNTBIRTH|NO_MINVENT);
sprout = makemon(mtmp->data,(mtmp->mx-1)+rn2(3),(mtmp->my-1)+rn2(3),MM_CHECK_GOODPOS|MM_NOCOUNTBIRTH|NO_MINVENT);
if(sprout) sprout->mhp = In_hell(&u.uz) ? sprout->mhp*3/4 : sprout->mhp/2;
}
}