From 7e1f0208464ae50f914b6a87a7a7010f56cde80b Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 18 Jun 2019 02:39:45 -0700 Subject: [PATCH 1/3] curing green slime bit A recent change to make_slimed() overlooked a different recent change in how mon->m_ap_type and youmonst.m_ap_type are referenced. In this case it had no impact; fix on general principles. --- src/potion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/potion.c b/src/potion.c index a07fcd0d8..18c6b584f 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1559664951 2019/06/04 16:15:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.161 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1560850774 2019/06/18 09:39:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.162 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -188,7 +188,7 @@ const char *msg; if (!Slimed) { dealloc_killer(find_delayed_killer(SLIMED)); /* fake appearance is set late in turn-to-slime countdown */ - if (youmonst.m_ap_type == M_AP_MONSTER + if (U_AP_TYPE == M_AP_MONSTER && youmonst.mappearance == PM_GREEN_SLIME) { youmonst.m_ap_type = M_AP_NOTHING; youmonst.mappearance = 0; From c9962c9d3428720a81ae2c2922de5ed20366a378 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 18 Jun 2019 02:43:41 -0700 Subject: [PATCH 2/3] mkroom.h update Give room type enums explicit values so that it is easier to find them when searching by value rather than by name. Also some reformatting. --- include/mkroom.h | 84 ++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/include/mkroom.h b/include/mkroom.h index 9d724552d..3439889a0 100644 --- a/include/mkroom.h +++ b/include/mkroom.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkroom.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */ +/* NetHack 3.6 mkroom.h $NHDT-Date: 1560851014 2019/06/18 09:43:34 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.16 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2016. */ /* NetHack may be freely redistributed. See license for details. */ @@ -32,8 +32,8 @@ struct shclass { #define D_SHOP 1 /* shop-like placement */ #define D_TEMPLE 2 /* temple-like placement */ struct itp { - int iprob; /* probability of an item type */ - int itype; /* item type: if >=0 a class, if < 0 a specific item */ + int iprob; /* probability of an item type */ + int itype; /* item type: if >=0 a class, if < 0 a specific item */ } iprobs[6]; const char *const *shknms; /* list of shopkeeper names for this type */ }; @@ -53,31 +53,31 @@ extern NEARDATA coord doors[DOORMAX]; /* values for rtype in the room definition structure */ enum roomtype_types { - OROOM = 0, /* ordinary room */ - COURT = 2, /* contains a throne */ - SWAMP, /* contains pools */ - VAULT, /* contains piles of gold */ - BEEHIVE, /* contains killer bees and royal jelly */ - MORGUE, /* contains corpses, undead and ghosts */ - BARRACKS, /* contains soldiers and their gear */ - ZOO, /* floor covered with treasure and monsters */ - DELPHI, /* contains Oracle and peripherals */ - TEMPLE, /* contains a shrine */ - LEPREHALL, /* leprechaun hall (Tom Proudfoot) */ - COCKNEST, /* cockatrice nest (Tom Proudfoot) */ - ANTHOLE, /* ants (Tom Proudfoot) */ - SHOPBASE, /* everything above this is a shop */ - ARMORSHOP, /* specific shop defines for level compiler */ - SCROLLSHOP, - POTIONSHOP, - WEAPONSHOP, - FOODSHOP, - RINGSHOP, - WANDSHOP, - TOOLSHOP, - BOOKSHOP, - FODDERSHOP, /* health food store */ - CANDLESHOP + OROOM = 0, /* ordinary room */ + COURT = 2, /* contains a throne */ + SWAMP = 3, /* contains pools */ + VAULT = 4, /* detached room usually reached via teleport trap */ + BEEHIVE = 5, /* contains killer bees and royal jelly */ + MORGUE = 6, /* contains corpses, undead and graves */ + BARRACKS = 7, /* contains soldiers and their gear */ + ZOO = 8, /* floor covered with treasure and monsters */ + DELPHI = 9, /* contains Oracle and peripherals */ + TEMPLE = 10, /* contains a shrine (altar attended by priest[ess]) */ + LEPREHALL = 11, /* leprechaun hall (Tom Proudfoot) */ + COCKNEST = 12, /* cockatrice nest (Tom Proudfoot) */ + ANTHOLE = 13, /* ants (Tom Proudfoot) */ + SHOPBASE = 14, /* everything above this is a shop */ + ARMORSHOP = 15, /* specific shop defines for level compiler */ + SCROLLSHOP = 16, + POTIONSHOP = 17, + WEAPONSHOP = 18, + FOODSHOP = 19, + RINGSHOP = 20, + WANDSHOP = 21, + TOOLSHOP = 22, + BOOKSHOP = 23, + FODDERSHOP = 24, /* health food store */ + CANDLESHOP = 25 }; #define MAXRTYPE (CANDLESHOP) /* maximum valid room type */ @@ -87,25 +87,19 @@ enum roomtype_types { #define ANY_TYPE (-1) #define ANY_SHOP (-2) -#define NO_ROOM 0 /* indicates lack of room-occupancy */ -#define SHARED 1 /* indicates normal shared boundary */ -#define SHARED_PLUS \ - 2 /* indicates shared boundary - extra adjacent- \ - * square searching required */ +#define NO_ROOM 0 /* indicates lack of room-occupancy */ +#define SHARED 1 /* indicates normal shared boundary */ +#define SHARED_PLUS 2 /* indicates shared boundary - extra adjacent-square + * searching required */ +#define ROOMOFFSET 3 /* (levl[x][y].roomno - ROOMOFFSET) gives rooms[] index, + * for inside-squares and non-shared boundaries */ -#define ROOMOFFSET \ - 3 /* \ - * (levl[x][y].roomno - ROOMOFFSET) gives \ - * rooms[] index, for inside-squares and \ - * non-shared boundaries. \ - */ - -#define IS_ROOM_PTR(x) ((x) >= rooms && (x) < rooms + MAXNROFROOMS) -#define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS) -#define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS) +#define IS_ROOM_PTR(x) ((x) >= rooms && (x) < rooms + MAXNROFROOMS) +#define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS) +#define IS_SUBROOM_PTR(x) ((x) >= subrooms && (x) < subrooms + MAXNROFROOMS) #define IS_SUBROOM_INDEX(x) ((x) > MAXNROFROOMS && (x) < (MAXNROFROOMS * 2)) -#define ROOM_INDEX(x) ((x) -rooms) -#define SUBROOM_INDEX(x) ((x) -subrooms) +#define ROOM_INDEX(x) ((x) -rooms) +#define SUBROOM_INDEX(x) ((x) -subrooms) #define IS_LAST_ROOM_PTR(x) (ROOM_INDEX(x) == nroom) #define IS_LAST_SUBROOM_PTR(x) (!nsubroom || SUBROOM_INDEX(x) == nsubroom) From 1c03d0970115c776d1c4791fea3c33f70b0b5378 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 18 Jun 2019 03:52:28 -0700 Subject: [PATCH 3/3] curses map window tty ignores map column #0 (0-based index), like the core, and draws the map in screen columns 1 (1-based index) through 79, leaving screen column 80 blank. curses was drawing all 80 map columns and since #0 was always unused, screen column 1 was blank and the map was shown in 2 through 80. Change curses to work like tty. This was too easy; there may be problems lurking. One known issue: it should be made smarter about when clipping/panning is necessary since it thinks that a full 80 columns are needed but 79 suffice. --- doc/fixes36.3 | 3 ++- win/curses/cursmisc.c | 2 ++ win/curses/curswins.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 1dc12edd1..23780792c 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.56 $ $NHDT-Date: 1560611967 2019/06/15 15:19:27 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.57 $ $NHDT-Date: 1560855142 2019/06/18 10:52:22 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -128,6 +128,7 @@ curses: don't convert ^M (or or key) into ^J; both ^J and ^M commands, ^J means run toward bottom of screen (when number_pad is off) and ^M is not bound to any command, so accidental won't cause the hero to try to move +curses: draw map in screen columns 1..79 like tty, rather than in 2..80 curses+EDIT_GETLIN: when a prompt's answer was preloaded, using ESC to discard it deleted it from the answer buffer but didn't erase it from screen tty: re-do one optimization used when status conditions have all been removed diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 223a8be82..2991c61d7 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -519,6 +519,8 @@ curses_move_cursor(winid wid, int x, int y) if (wid != MAP_WIN) { return; + } else { + --x; /* map column [0] isn't used, so shift everything over 1 col */ } #ifdef PDCURSES /* PDCurses seems to not handle wmove correctly, so we use move and diff --git a/win/curses/curswins.c b/win/curses/curswins.c index 5c9997633..9599b4de8 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -363,10 +363,10 @@ curs_destroy_all_wins() void curses_putch(winid wid, int x, int y, int ch, int color, int attr) { + static boolean map_initted = FALSE; int sx, sy, ex, ey; boolean border = curses_window_has_border(wid); nethack_char nch; - static boolean map_initted = FALSE; /* if (wid == STATUS_WIN) { curses_update_stats(); @@ -381,6 +381,7 @@ curses_putch(winid wid, int x, int y, int ch, int color, int attr) map_initted = TRUE; } + --x; /* map column [0] is not used; draw column [1] in first screen col */ map[y][x].ch = ch; map[y][x].color = color; map[y][x].attr = attr;