Update bones.c

wanghao_branch
p9yu5zbfh 1 year ago
parent eb25b624aa
commit 79179f09c0

@ -17,18 +17,22 @@ no_bones_level(d_level *lev)
{ {
s_level *sptr; s_level *sptr;
// 如果当前d_level不是gs.save_dlevel则将当前d_level赋值为gs.save_dlevel
if (ledger_no(&gs.save_dlevel)) if (ledger_no(&gs.save_dlevel))
assign_level(lev, &gs.save_dlevel); assign_level(lev, &gs.save_dlevel);
return (boolean) (((sptr = Is_special(lev)) != 0 && !sptr->boneid) // 满足以下条件时返回True表示该层不能生成骨堆
|| !gd.dungeons[lev->dnum].boneid return (boolean) (
/* no bones on the last or multiway branch levels // 1. 该层是特殊层并且没有设置骨堆id
in any dungeon (level 1 isn't multiway) */ ((sptr = Is_special(lev)) != 0 && !sptr->boneid)
|| Is_botlevel(lev) // 2. 该层所在的地牢中没有设置骨堆id
|| (Is_branchlev(lev) && lev->dlevel > 1) || !gd.dungeons[lev->dnum].boneid
/* no bones in the invocation level */ // 3. 该层是地牢中的最后一层或多路分支的末端层(除了第一层)
|| (In_hell(lev) || Is_botlevel(lev)
&& lev->dlevel == dunlevs_in_dungeon(lev) - 1)); || (Is_branchlev(lev) && lev->dlevel > 1)
// 4. 该层是地狱入口
|| (In_hell(lev) && lev->dlevel == dunlevs_in_dungeon(lev) - 1)
);
} }
/* Call this function for each fruit object saved in the bones level: it marks /* Call this function for each fruit object saved in the bones level: it marks
@ -195,6 +199,7 @@ void
sanitize_name(char *namebuf) sanitize_name(char *namebuf)
{ {
int c; int c;
// 是否在终端窗口下且终端不支持8位字符集
boolean strip_8th_bit = (WINDOWPORT(tty) boolean strip_8th_bit = (WINDOWPORT(tty)
&& !iflags.wc_eight_bit_input); && !iflags.wc_eight_bit_input);
@ -202,13 +207,16 @@ sanitize_name(char *namebuf)
only the current player could have left these bones--except only the current player could have left these bones--except
things like "hearse" and other bones exchange schemes make things like "hearse" and other bones exchange schemes make
that assumption false */ that assumption false */
// 遍历字符串中的每个字符,进行处理
while (*namebuf) { while (*namebuf) {
// 将字符转换为7位ASCII码值
c = *namebuf & 0177; c = *namebuf & 0177;
if (c < ' ' || c == '\177') { if (c < ' ' || c == '\177') {
/* non-printable or undesirable */ /* 非可打印字符或不需要的字符,用'.'代替 */
*namebuf = '.'; *namebuf = '.';
} else if (c != *namebuf) { } else if (c != *namebuf) {
/* expected to be printable if user wants such things */ /* 如果字符不是可打印字符且用户希望看到可打印字符时,则用'_'代替 */
if (strip_8th_bit) if (strip_8th_bit)
*namebuf = '_'; *namebuf = '_';
} }
@ -216,6 +224,7 @@ sanitize_name(char *namebuf)
} }
} }
/* Give object to a random object-liking monster on or adjacent to x,y /* Give object to a random object-liking monster on or adjacent to x,y
but skipping hero's location. but skipping hero's location.
If no such monster, place object on floor at x,y. */ If no such monster, place object on floor at x,y. */
@ -388,11 +397,15 @@ remove_mon_from_bones(struct monst *mtmp)
{ {
struct permonst *mptr = mtmp->data; struct permonst *mptr = mtmp->data;
// If the monster is the Wizard, Medusa, or has specific monster sounds,
// or is Vlad, or is the Oracle (with specific condition), remove it from bones.
if (mtmp->iswiz || mptr == &mons[PM_MEDUSA] if (mtmp->iswiz || mptr == &mons[PM_MEDUSA]
|| mptr->msound == MS_NEMESIS || mptr->msound == MS_LEADER || mptr->msound == MS_NEMESIS || mptr->msound == MS_LEADER
|| is_Vlad(mtmp) /* mptr == &mons[VLAD_THE_IMPALER] || cham == VLAD */ || is_Vlad(mtmp) /* mptr == &mons[VLAD_THE_IMPALER] || cham == VLAD */
|| (mptr == &mons[PM_ORACLE] && !fixuporacle(mtmp))) || (mptr == &mons[PM_ORACLE] && !fixuporacle(mtmp)))
{
mongone(mtmp); mongone(mtmp);
}
} }
/* save bones and possessions of a deceased adventurer */ /* save bones and possessions of a deceased adventurer */

Loading…
Cancel
Save