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