-/* NetHack 3.7 extern.h $NHDT-Date: 1646136928 2022/03/01 12:15:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1062 $ */
+/* NetHack 3.7 extern.h $NHDT-Date: 1646171621 2022/03/01 21:53:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1063 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
#ifdef SCORE_ON_BOTL
extern long botl_score(void);
#endif
-extern int describe_level(char *);
+extern int describe_level(char *, int);
extern void status_initialize(boolean);
extern void status_finish(void);
extern boolean exp_percent_changing(void);
-/* NetHack 3.7 botl.c $NHDT-Date: 1606765211 2020/11/30 19:40:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.193 $ */
+/* NetHack 3.7 botl.c $NHDT-Date: 1646171622 2022/03/01 21:53:42 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.209 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
*/
/* dungeon location plus gold */
- (void) describe_level(dloc); /* includes at least one trailing space */
+ (void) describe_level(dloc, 1); /* includes at least one trailing space */
if ((money = money_cnt(g.invent)) < 0L)
money = 0L; /* ought to issue impossible() and then discard gold */
Sprintf(eos(dloc), "%s:%-2ld", /* strongest hero can lift ~300000 gold */
/* provide the name of the current level for display by various ports */
int
-describe_level(char *buf)
+describe_level(
+ char *buf, /* output buffer */
+ int dflgs) /* 1: append trailing space; 2: include dungeon branch name */
{
+ boolean addspace = (dflgs & 1) != 0, /* (used to be unconditional) */
+ addbranch = (dflgs & 2) != 0; /* False: status, True: livelog */
int ret = 1;
- /* TODO: Add in dungeon name */
if (Is_knox(&u.uz)) {
- Sprintf(buf, "%s ", g.dungeons[u.uz.dnum].dname);
+ Sprintf(buf, "%s", g.dungeons[u.uz.dnum].dname);
+ addbranch = FALSE;
} else if (In_quest(&u.uz)) {
- Sprintf(buf, "Home %d ", dunlev(&u.uz));
+ Sprintf(buf, "Home %d", dunlev(&u.uz));
} else if (In_endgame(&u.uz)) {
/* [3.6.2: this used to be "Astral Plane" or generic "End Game"] */
(void) endgamelevelname(buf, depth(&u.uz));
- (void) strsubst(buf, "Plane of ", ""); /* just keep <element> */
- Strcat(buf, " ");
+ if (!addbranch)
+ (void) strsubst(buf, "Plane of ", ""); /* just keep <element> */
+ addbranch = FALSE;
} else {
/* ports with more room may expand this one */
- Sprintf(buf, "Dlvl:%-2d ", depth(&u.uz));
+ if (!addbranch)
+ Sprintf(buf, "Dlvl:%-2d", depth(&u.uz));
+ else
+ Sprintf(buf, "level %d", depth(&u.uz));
ret = 0;
}
+ if (addbranch) {
+ Sprintf(eos(buf), ", %s", g.dungeons[u.uz.dnum].dname);
+ (void) strsubst(buf, "The ", "the ");
+ }
+ if (addspace)
+ Strcat(buf, " ");
return ret;
}
g.blstats[idx][BL_HPMAX].a.a_int = min(i, 9999);
/* Dungeon level. */
- (void) describe_level(g.blstats[idx][BL_LEVELDESC].val);
+ (void) describe_level(g.blstats[idx][BL_LEVELDESC].val, 1);
g.valset[BL_LEVELDESC] = TRUE; /* indicate val already set */
/* Gold */
-/* NetHack 3.7 do.c $NHDT-Date: 1646136939 2022/03/01 12:15:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.295 $ */
+/* NetHack 3.7 do.c $NHDT-Date: 1646171623 2022/03/01 21:53:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.296 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
[TODO: if an achievement for receiving quest call from leader
gets added, that should come after this rather than take place
where the message is delivered above] */
- if (new)
- /* FIXME: this shows level number relative to the start of the
- branch (so "entered new level 3, Vlad's Tower" when going
- into the first level of that branch); it should be changed
- to show the level number that appears on the status lines;
- also in the endgame it shows arbitrary level number instead
- of elemental plane name */
- livelog_printf(LL_DEBUG, "entered new level %d, %s",
- dunlev(&u.uz), g.dungeons[u.uz.dnum].dname);
+ if (new) {
+ char dloc[QBUFSZ];
+ /* Astral is excluded as a major event here because entry to it
+ is already one due to that being an achievement */
+ boolean major = In_endgame(&u.uz) && !Is_astralevel(&u.uz);
+
+ (void) describe_level(dloc, 2);
+ livelog_printf(major ? LL_ACHIEVE : LL_DEBUG, "entered %s", dloc);
+ }
assign_level(&u.uz0, &u.uz); /* reset u.uz0 */
#ifdef INSURANCE
-/* NetHack 3.7 insight.c $NHDT-Date: 1646136941 2022/03/01 12:15:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.53 $ */
+/* NetHack 3.7 insight.c $NHDT-Date: 1646171624 2022/03/01 21:53:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.54 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
{ LL_ACHIEVE, "acquired the Book of the Dead" },
{ LL_ACHIEVE, "performed the invocation" },
{ LL_ACHIEVE, "acquired The Amulet of Yendor" },
- { LL_ACHIEVE, "entered the Planes" },
+ { LL_ACHIEVE, "entered the Elemental Planes" },
{ LL_ACHIEVE, "entered the Astral Plane" },
{ LL_ACHIEVE, "ascended" },
{ LL_ACHIEVE | LL_SPOILER, "acquired the Mines' End luckstone" },
int
doconduct(void)
{
- show_conduct(0);
+ show_conduct(ENL_GAMEINPROGRESS);
return ECMD_OK;
}
{
#ifdef CHRONICLE
if (g.gamelog) {
- show_gamelog(0);
+ show_gamelog(ENL_GAMEINPROGRESS);
} else {
pline("No chronicled events.");
}
-/* NetHack 3.7 mon.c $NHDT-Date: 1629817677 2021/08/24 15:07:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.384 $ */
+/* NetHack 3.7 mon.c $NHDT-Date: 1646171625 2022/03/01 21:53:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.410 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
/* Is the square close enough for the monster to move or attack into? */
boolean
-monnear(struct monst* mon, int x, int y)
+monnear(struct monst *mon, int x, int y)
{
int distance = dist2(mon->mx, mon->my, x, y);
}
if (count != iflags.purge_monsters) {
- describe_level(buf);
+ describe_level(buf, 2);
impossible("dmonsfree: %d removed doesn't match %d pending on %s",
count, iflags.purge_monsters, buf);
}
/* called when monster is moved to larger structure */
void
-replmon(struct monst* mtmp, struct monst* mtmp2)
+replmon(struct monst *mtmp, struct monst *mtmp2)
{
struct obj *otmp;
}
void
-dealloc_monst(struct monst* mon)
+dealloc_monst(struct monst *mon)
{
char buf[QBUFSZ];
buf[0] = '\0';
if (mon->nmon) {
- describe_level(buf);
+ describe_level(buf, 2);
panic("dealloc_monst with nmon on %s", buf);
}
if (mon->mextra)
-/* NetHack 3.7 sp_lev.c $NHDT-Date: 1622361654 2021/05/30 08:00:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.233 $ */
+/* NetHack 3.7 sp_lev.c $NHDT-Date: 1646171627 2022/03/01 21:53:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.257 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
} else if (!iflags.lua_testing) {
char lbuf[QBUFSZ];
- (void) describe_level(lbuf); /* always has a trailing space */
+ (void) describe_level(lbuf, 1 | 2);
impossible("create_object: unknown achievement (%s\"%s\")",
lbuf, simpleonames(otmp));
}
-/* NetHack 3.7 steed.c $NHDT-Date: 1582155885 2020/02/19 23:44:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.79 $ */
+/* NetHack 3.7 steed.c $NHDT-Date: 1646171628 2022/03/01 21:53:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.95 $ */
/* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */
/* normal map bounds are <1..COLNO-1,0..ROWNO-1> but sometimes
vault guards (either living or dead) are parked at <0,0> */
if (!isok(x, y) && (x != 0 || y != 0 || !mon->isgd)) {
- describe_level(buf);
+ describe_level(buf, 0);
impossible("trying to place %s at <%d,%d> mstate:%lx on %s",
minimal_monnam(mon, TRUE), x, y, mon->mstate, buf);
x = y = 0;
if (mon == u.usteed
/* special case is for convoluted vault guard handling */
|| (DEADMONSTER(mon) && !(mon->isgd && x == 0 && y == 0))) {
- describe_level(buf);
+ describe_level(buf, 0);
impossible("placing %s onto map, mstate:%lx, on %s?",
(mon == u.usteed) ? "steed" : "defunct monster",
mon->mstate, buf);
return;
}
if ((othermon = g.level.monsters[x][y]) != 0) {
- describe_level(buf);
+ describe_level(buf, 0);
monnm = minimal_monnam(mon, FALSE);
othnm = (mon != othermon) ? minimal_monnam(othermon, TRUE) : "itself";
impossible("placing %s over %s at <%d,%d>, mstates:%lx %lx on %s?",
buf.toLatin1().constData());
name.setLabel(buf2, NetHackQtLabelledIcon::NoNum, u.ulevel);
- if (!describe_level(buf3)) {
+ if (!describe_level(buf3, 0)) {
Sprintf(buf3, "%s, level %d",
g.dungeons[u.uz.dnum].dname, ::depth(&u.uz));
}
-/* NetHack 3.7 winstat.c $NHDT-Date: 1641763638 2022/01/09 21:27:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.35 $ */
+/* NetHack 3.7 winstat.c $NHDT-Date: 1646171629 2022/03/01 21:53:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.36 $ */
/* Copyright (c) Dean Luick, 1992 */
/* NetHack may be freely redistributed. See license for details. */
rank_of(u.ulevel, g.pl_character[0], flags.female));
} else if (attr_rec == &shown_stats[F_DLEVEL]) {
- if (!describe_level(buf)) {
+ if (!describe_level(buf, 0)) {
Strcpy(buf, g.dungeons[u.uz.dnum].dname);
Sprintf(eos(buf), ", level %d", depth(&u.uz));
}
return cattr;
}
-/* Returns a complete curses attribute. Used to possibly bold/underline/etc HP/Pw. */
+/* Returns a complete curses attribute.
+ Used to possibly bold/underline/etc HP/Pw. */
#ifdef STATUS_COLORS
static attr_t
hpen_color_attr(boolean is_hp, int cur, int max)
#endif
/* Return color for the HP bar.
- With status colors ON, this respect its configuration (defaulting to gray), but
- only obeys the color (no weird attributes for the HP bar).
- With status colors OFF, this returns reasonable defaults which are also used
- for the HP/Pw text itself. */
+ With status colors ON, this respect its configuration (defaulting to gray),
+ but only obeys the color (no weird attributes for the HP bar).
+ With status colors OFF, this returns reasonable defaults which are also
+ used for the HP/Pw text itself. */
static int
hpen_color(boolean is_hp, int cur, int max)
{
#ifdef STATUS_COLORS
if (iflags.use_status_colors) {
struct color_option stat_color;
- stat_color = percentage_color_of(cur, max, is_hp ? hp_colors : pw_colors);
+ stat_color = percentage_color_of(cur, max,
+ is_hp ? hp_colors : pw_colors);
if (stat_color.color == NO_COLOR)
return CLR_GRAY;
y++;
wmove(win, y, x);
- describe_level(buf);
+ describe_level(buf, 0);
wprintw(win, "%s", buf);
wmove(win, y++, x);
if (Upolyd)
- print_statdiff("Hit Dice: ", &prevlevel, mons[u.umonnum].mlevel, STAT_OTHER);
+ print_statdiff("Hit Dice: ", &prevlevel, mons[u.umonnum].mlevel,
+ STAT_OTHER);
else if (flags.showexp) {
print_statdiff("Experience: ", &prevlevel, u.ulevel, STAT_OTHER);
/* use waddch, we don't want to highlight the '/' */
#ifdef SCORE_ON_BOTL
if (flags.showscore) {
- print_statdiff("Score: ", &prevscore, botl_score(), STAT_OTHER);
+ print_statdiff("Score: ", &prevscore, botl_score(),
+ STAT_OTHER);
wmove(win, y++, x);
}
#endif /* SCORE_ON_BOTL */
*x = mx;
}
-#define statprob(str, trouble) \
+#define statprob(str, trouble) \
curses_add_status(win, align_right, vertical, x, y, str, trouble)
/* Hunger */
if (!vertical && !align_right)
waddch(win, ' ');
- /* For whatever reason, hunger states have trailing spaces. Get rid of them. */
+ /* For whatever reason, hunger states have trailing spaces. Get rid of
+ them. */
char buf[BUFSZ];
Strcpy(buf, str);
int i;