-/* NetHack 3.6 extern.h $NHDT-Date: 1494107197 2017/05/06 21:46:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.587 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1495346095 2017/05/21 05:54:55 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.588 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E int FDECL(dosearch0, (int));
E int NDECL(dosearch);
E void NDECL(sokoban_detect);
+#ifdef DUMPLOG
E void NDECL(dump_map);
+#endif
E void FDECL(reveal_terrain, (int, int));
/* ### dig.c ### */
-/* NetHack 3.6 detect.c $NHDT-Date: 1491705573 2017/04/09 02:39:33 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.76 $ */
+/* NetHack 3.6 detect.c $NHDT-Date: 1495346103 2017/05/21 05:55:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.77 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return glyph;
}
+#ifdef DUMPLOG
void
dump_map()
{
- int x, y, glyph;
+ int x, y, glyph, skippedrows;
int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON;
int default_glyph = cmap_to_glyph(level.flags.arboreal ? S_tree : S_stone);
char buf[BUFSZ];
+ boolean blankrow, toprow;
+ /*
+ * Squeeze out excess vertial space when dumping the map.
+ * If there are any blank map rows at the top, suppress them
+ * (our caller has already printed a separator). If there is
+ * more than one blank map row at the bottom, keep just one.
+ * Any blank rows within the middle of the map are kept.
+ * Note: putstr() with winid==0 is for dumplog.
+ */
+ skippedrows = 0;
+ toprow = TRUE;
for (y = 0; y < ROWNO; y++) {
+ blankrow = TRUE; /* assume blank until we discover otherwise */
for (x = 1; x < COLNO; x++) {
int ch, color;
unsigned special;
glyph = reveal_terrain_getglyph(x,y, FALSE, u.uswallow,
default_glyph, subset);
(void) mapglyph(glyph, &ch, &color, &special, x, y);
- buf[x-1] = ch;
+ buf[x - 1] = ch;
+ if (ch != ' ')
+ blankrow = FALSE;
+ }
+ if (!blankrow) {
+ buf[x - 2] = '\0';
+ if (toprow) {
+ skippedrows = 0;
+ toprow = FALSE;
+ }
+ for (x = 0; x < skippedrows; x++)
+ putstr(0, 0, "");
+ putstr(0, 0, buf); /* map row #y */
+ } else {
+ ++skippedrows;
}
- buf[x-2] = '\0';
- putstr(0,0, buf);
}
+ if (skippedrows)
+ putstr(0, 0, "");
}
+#endif /* DUMPLOG */
/* idea from crawl; show known portion of map without any monsters,
objects, or traps occluding the view of the underlying terrain */