Merge branch 'entrez-fix322' into NetHack-3.7

This commit is contained in:
nhmall
2020-12-31 21:25:16 -05:00
4 changed files with 25 additions and 18 deletions

View File

@@ -162,6 +162,7 @@ E void FDECL(drop_upon_death, (struct monst *, struct obj *, int, int));
E boolean NDECL(can_make_bones);
E void FDECL(savebones, (int, time_t, struct obj *));
E int NDECL(getbones);
E boolean FDECL(bones_include_name, (const char *));
/* ### botl.c ### */
@@ -1486,7 +1487,6 @@ E void NDECL(kill_genocided_monsters);
E void FDECL(golemeffects, (struct monst *, int, int));
E boolean FDECL(angry_guards, (BOOLEAN_P));
E void NDECL(pacify_guards);
E struct monst *FDECL(find_ghost_with_name, (char *));
E void FDECL(decide_to_shapeshift, (struct monst *, int));
E boolean FDECL(vamp_stone, (struct monst *));

View File

@@ -656,4 +656,27 @@ getbones()
return ok;
}
/* check whether current level contains bones from a particular player */
boolean
bones_include_name(name)
const char *name;
{
struct cemetery *bp;
int len;
char buf[BUFSZ];
/* prepare buffer by appending terminal hyphen to name, to avoid partial
* matches producing false positives */
Strcpy(buf, name);
Strcat(buf, "-");
len = strlen(buf);
for (bp = g.level.bonesinfo; bp; bp = bp->next) {
if (!strncmp(bp->who, buf, len))
return TRUE;
}
return FALSE;
}
/*bones.c*/

View File

@@ -1473,7 +1473,7 @@ boolean at_stairs, falling, portal;
mklev();
new = TRUE; /* made the level */
familiar = (find_ghost_with_name(g.plname) != (struct monst *) 0);
familiar = bones_include_name(g.plname);
} else {
/* returning to previously visited level; reload it */
nhfp = open_levelfile(new_ledger, whynot);

View File

@@ -4647,22 +4647,6 @@ pacify_guards()
}
}
struct monst *
find_ghost_with_name(str)
char *str;
{
struct monst *mtmp;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)
|| mtmp->data != &mons[PM_GHOST] || !has_mgivenname(mtmp))
continue;
if (!strcmpi(MGIVENNAME(mtmp), str))
return mtmp;
}
return (struct monst *) 0;
}
void
mimic_hit_msg(mtmp, otyp)
struct monst *mtmp;