-/* NetHack 3.6 dungeon.c $NHDT-Date: 1523308357 2018/04/09 21:12:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.87 $ */
+/* NetHack 3.6 dungeon.c $NHDT-Date: 1559476918 2019/06/02 12:01:58 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.95 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
int, int, int *));
STATIC_DCL const char *FDECL(seen_string, (XCHAR_P, const char *));
STATIC_DCL const char *FDECL(br_string2, (branch *));
-STATIC_DCL const char *FDECL(endgamelevelname, (char *, int));
STATIC_DCL const char *FDECL(shop_string, (int));
STATIC_DCL char *FDECL(tunesuffix, (mapseen *, char *));
next_ms = curr_ms->next;
if (curr_ms->custom)
free((genericptr_t) curr_ms->custom);
+ if (curr_ms->final_resting_place)
+ savecemetery(fd, FREE_SAVE, &curr_ms->final_resting_place);
free((genericptr_t) curr_ms);
}
mapseenchn = 0;
if (dunlevs_in_dungeon(&x->dlevel) > 1 - dungeons[i].depth_start)
dungeons[i].depth_start -= 1;
/* TODO: strip "dummy" out all the way here,
- so that it's hidden from <ctrl/O> feedback. */
+ so that it's hidden from '#wizwhere' feedback. */
}
#ifdef DEBUG
u_on_newpos(x, y)
int x, y;
{
+ if (!isok(x, y)) { /* validate location */
+ void VDECL((*func), (const char *, ...)) PRINTF_F(1, 2);
+
+ func = (x < 0 || y < 0 || x > COLNO - 1 || y > ROWNO - 1) ? panic
+ : impossible;
+ (*func)("u_on_newpos: trying to place hero off map <%d,%d>", x, y);
+ }
u.ux = x;
u.uy = y;
#ifdef CLIPPING
u.ux0 = u.ux, u.uy0 = u.uy;
}
-/* place you on a random location */
+/* place you on a random location when arriving on a level */
void
u_on_rndspot(upflag)
int upflag;
place_lregion(dndest.lx, dndest.ly, dndest.hx, dndest.hy,
dndest.nlx, dndest.nly, dndest.nhx, dndest.nhy,
LR_DOWNTELE, (d_level *) 0);
+
+ /* might have just left solid rock and unblocked levitation */
+ switch_terrain();
}
/* place you on the special staircase */
*(eos(buf) - 6) = '\0';
}
/* hell is the old name, and wouldn't match; gehennom would match its
- branch, yielding the castle level instead of the valley of the dead */
+ branch, yielding the castle level instead of valley of the dead */
if (!strcmpi(nam, "gehennom") || !strcmpi(nam, "hell")) {
if (In_V_tower(&u.uz))
nam = " to Vlad's tower"; /* branch to... */
for (br = branches; br; br = br->next) {
if (br->end1.dnum == dnum && lower_bound < br->end1.dlevel
&& br->end1.dlevel <= upper_bound) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(buf, "%c %s to %s: %d",
bymenu ? chr_u_on_lvl(&br->end1) : ' ',
br_string(br->type),
descr = unplaced ? "\92n\89º" : "\83\8c\83x\83\8b";
nlev = dptr->num_dunlevs;
if (nlev > 1)
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(buf, "%s: %s %d to %d", dptr->dname, makeplural(descr),
dptr->depth_start, dptr->depth_start + nlev - 1);
#else
*/
Strcat(buf, ", \89º\82©\82ç\82Ì\93ü\82è\8cû");
else
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(eos(buf), ", entrance on %d",
dptr->depth_start + dptr->entry_lev - 1);
#else
putstr(win, 0, "\95\82\93®\95ª\8aò");
first = FALSE;
}
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(buf, " %s to %s", br_string(br->type),
dungeons[br->end2.dnum].dname);
#else
/* I hate searching for the invocation pos while debugging. -dean */
if (Invocation_lev(&u.uz)) {
putstr(win, 0, "");
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(buf, "Invocation position @ (%d,%d), hero @ (%d,%d)",
inv_pos.x, inv_pos.y, u.ux, u.uy);
#else
trap->tx, trap->ty, u.ux, u.uy);
/* only report "no portal found" when actually expecting a portal */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
else if (Is_earthlevel(&u.uz) || Is_waterlevel(&u.uz)
|| Is_firelevel(&u.uz) || Is_airlevel(&u.uz)
|| Is_qstart(&u.uz) || at_dgn_entrance("The Quest")
if (mptr->custom) {
char tmpbuf[BUFSZ];
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(tmpbuf, "Replace annotation \"%.30s%s\" with?", mptr->custom,
(strlen(mptr->custom) > 30) ? "..." : "");
#else
struct cemetery *bp, *bpnext;
for (mptr = mapseenchn; mptr; mprev = mptr, mptr = mptr->next)
- if (dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel == ledger_num)
+ if (dungeons[mptr->lev.dnum].ledger_start + mptr->lev.dlevel
+ == ledger_num)
break;
if (!mptr)
bwrite(fd, (genericptr_t) &mptr->custom_lth, sizeof mptr->custom_lth);
if (mptr->custom_lth)
bwrite(fd, (genericptr_t) mptr->custom, mptr->custom_lth);
- bwrite(fd, (genericptr_t) &mptr->msrooms, sizeof mptr->msrooms);
+ bwrite(fd, (genericptr_t) mptr->msrooms, sizeof mptr->msrooms);
savecemetery(fd, WRITE_SAVE, &mptr->final_resting_place);
}
load->custom[load->custom_lth] = '\0';
} else
load->custom = 0;
- mread(fd, (genericptr_t) &load->msrooms, sizeof load->msrooms);
+ mread(fd, (genericptr_t) load->msrooms, sizeof load->msrooms);
restcemetery(fd, &load->final_resting_place);
return load;
if (ltyp == DRAWBRIDGE_UP)
ltyp = db_under_typ(levl[x][y].drawbridgemask);
if ((mtmp = m_at(x, y)) != 0
- && mtmp->m_ap_type == M_AP_FURNITURE && canseemon(mtmp))
+ && M_AP_TYPE(mtmp) == M_AP_FURNITURE && canseemon(mtmp))
ltyp = cmap_to_type(mtmp->mappearance);
lastseentyp[x][y] = ltyp;
}
}
/*ARGUSED*/
-/* valley and sanctum levels get automatic annotation once temple is entered
- */
+/* valley and sanctum levels get automatic annotation once temple is entered */
void
mapseen_temple(priest)
struct monst *priest UNUSED; /* currently unused; might be useful someday */
}
/* get the name of an endgame level; topten.c does something similar */
-STATIC_OVL const char *
+const char *
endgamelevelname(outbuf, indx)
char *outbuf;
int indx;
shop_string(rtype)
int rtype;
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
const char *str = "shop"; /* catchall */
#else
const char *str = "\93X"; /* catchall */
#endif
#define COMMA (i++ > 0 ? ", " : PREFIX)
/* "iterate" once; safe to use as ``if (cond) ADDTOBUF(); else whatever;'' */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
#define ADDNTOBUF(nam, var) \
do { \
if (var) \
if (mptr->custom)
Sprintf(eos(buf), " \"%s\"", mptr->custom);
if (on_level(&u.uz, &mptr->lev))
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(eos(buf), " <- You %s here.",
(!final || (final == 1 && how == ASCENDED)) ? "are"
: (final == 1 && how == ESCAPED) ? "left from"
*/
Sprintf(buf, "%s\83f\83\8b\83t\83@\83C\82Ì\90_\93a\81D", PREFIX);
} else if (In_sokoban(&mptr->lev)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(buf, "%s%s.", PREFIX,
mptr->flags.sokosolved ? "Solved" : "Unsolved");
#else
*/
Sprintf(buf, "%s\92P\8f\83\82È\95\94\89®\81D", PREFIX);
} else if (on_level(&mptr->lev, &qstart_level)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(buf, "%sHome%s.", PREFIX,
mptr->flags.unreachable ? " (no way back...)" : "");
#else
/* print out branches */
if (mptr->br) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(buf, "%s%s to %s", PREFIX, br_string2(mptr->br),
dungeons[mptr->br->end2.dnum].dname);
#else