livelog level entry events
Fix up the level descriptions used when logging an "entered new level" event. Most of the change is for adding an extra argument to calls to describe_level(). The curses portion is in a big chunk of old code suppressed by #if 0. I didn't notice that the level entry events are classified as LL_DEBUG until all the work was done. This promotes the entry events for the four Plane of <Element> levels from debug events to major ones instead. It doesn't do that for the Astral Plane because the entered-the-Astral- Plane achievement already produces a major event for that. Most other key level entry events are in a similar situation--or will become that way once another set of achievements eventually gets added--so there aren't any other event classification promotions.
This commit is contained in:
34
src/botl.c
34
src/botl.c
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
@@ -128,7 +128,7 @@ do_statusline2(void)
|
||||
*/
|
||||
|
||||
/* 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 */
|
||||
@@ -423,25 +423,39 @@ botl_score(void)
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -779,7 +793,7 @@ bot_via_windowport(void)
|
||||
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 */
|
||||
|
||||
20
src/do.c
20
src/do.c
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
@@ -1778,15 +1778,15 @@ goto_level(
|
||||
[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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -59,7 +59,7 @@ static struct ll_achieve_msg achieve_msg [] = {
|
||||
{ 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" },
|
||||
@@ -1957,7 +1957,7 @@ youhiding(boolean via_enlghtmt, /* englightment line vs topl message */
|
||||
int
|
||||
doconduct(void)
|
||||
{
|
||||
show_conduct(0);
|
||||
show_conduct(ENL_GAMEINPROGRESS);
|
||||
return ECMD_OK;
|
||||
}
|
||||
|
||||
@@ -2372,7 +2372,7 @@ do_gamelog(void)
|
||||
{
|
||||
#ifdef CHRONICLE
|
||||
if (g.gamelog) {
|
||||
show_gamelog(0);
|
||||
show_gamelog(ENL_GAMEINPROGRESS);
|
||||
} else {
|
||||
pline("No chronicled events.");
|
||||
}
|
||||
|
||||
12
src/mon.c
12
src/mon.c
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
@@ -2078,7 +2078,7 @@ mm_displacement(
|
||||
|
||||
/* 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);
|
||||
|
||||
@@ -2108,7 +2108,7 @@ dmonsfree(void)
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -2117,7 +2117,7 @@ dmonsfree(void)
|
||||
|
||||
/* 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;
|
||||
|
||||
@@ -2287,13 +2287,13 @@ dealloc_mextra(struct monst* m)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -2291,7 +2291,7 @@ create_object(object* o, struct mkroom* croom)
|
||||
} 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));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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. */
|
||||
|
||||
@@ -760,7 +760,7 @@ place_monster(struct monst* mon, int x, int y)
|
||||
/* 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;
|
||||
@@ -768,14 +768,14 @@ place_monster(struct monst* mon, int x, int y)
|
||||
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?",
|
||||
|
||||
Reference in New Issue
Block a user