From 7e72bc0944491c4d6b3d0094f488722ea558ca07 Mon Sep 17 00:00:00 2001 From: Bart House Date: Sat, 6 Jul 2019 14:18:02 -0700 Subject: [PATCH 1/4] mklev() set xxstairs_room pointers back to NULL upon completion. When mklev() is called multiple times, previous state stored in the xxstairs_room pointers can be mistakenly used when making decisions about the new level being constructed. This caused non-deterministic level creation behavior when replaying from a snapshot. --- src/mklev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mklev.c b/src/mklev.c index 525e0a58e..10f019f82 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -1016,6 +1016,10 @@ mklev() for (ridx = 0; ridx < SIZE(rooms); ridx++) rooms[ridx].orig_rtype = rooms[ridx].rtype; + dnstairs_room = NULL; + upstairs_room = NULL; + sstairs_room = NULL; + reseed_random(rn2); reseed_random(rn2_on_display_rng); } From bf672f7f47f792c9b3d1fb8106ee1bc475b2b23b Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 6 Jul 2019 16:18:23 -0700 Subject: [PATCH 2/4] Xstairs_room followup Add a comment to explain why upstairs_room, dnstairs_room, and sstiars_room aren't handled the same way has other level data. --- src/mklev.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mklev.c b/src/mklev.c index 10f019f82..749304267 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mklev.c $NHDT-Date: 1560304468 2019/06/12 01:54:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.61 $ */ +/* NetHack 3.6 mklev.c $NHDT-Date: 1562455089 2019/07/06 23:18:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.63 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Alex Smith, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -583,6 +583,10 @@ clear_level_structures() register int x, y; register struct rm *lev; + /* note: normally we'd start at x=1 because map column #0 isn't used + (except for placing vault guard at <0,0> when removed from the map + but not from the level); explicitly reset column #0 along with the + rest so that we start the new level with a completely clean slate */ for (x = 0; x < COLNO; x++) { lev = &levl[x][0]; for (y = 0; y < ROWNO; y++) { @@ -637,6 +641,7 @@ clear_level_structures() xdnstair = ydnstair = xupstair = yupstair = 0; sstairs.sx = sstairs.sy = 0; xdnladder = ydnladder = xupladder = yupladder = 0; + dnstairs_room = upstairs_room = sstairs_room = (struct mkroom *) 0; made_branch = FALSE; clear_regions(); } @@ -1016,9 +1021,12 @@ mklev() for (ridx = 0; ridx < SIZE(rooms); ridx++) rooms[ridx].orig_rtype = rooms[ridx].rtype; - dnstairs_room = NULL; - upstairs_room = NULL; - sstairs_room = NULL; + /* something like this usually belongs in clear_level_structures() + but these aren't saved and restored so might not retain their + values for the life of the current level; reset them to default + now so that they never do and no one will be tempted to introduce + a new use of them for anything on this level */ + dnstairs_room = upstairs_room = sstairs_room = (struct mkroom *) 0; reseed_random(rn2); reseed_random(rn2_on_display_rng); From e84a0625dcc3163f74ee02dbaa193853b5ad5b89 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 6 Jul 2019 16:41:04 -0700 Subject: [PATCH 3/4] curses moving left with ^H Typing ^H actually passed a 16-bit value back to the core which got interpreted as ^G after the extra bits were discarded. I don't think any previous changes to the curses interface caused this. It's astonishing that no one ever noticed; the world must be full of numpad users. --- doc/fixes36.3 | 3 ++- win/curses/cursmesg.c | 2 +- win/curses/cursmisc.c | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 52aa675e4..e9dd29e5f 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.84 $ $NHDT-Date: 1562203850 2019/07/04 01:30:50 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.85 $ $NHDT-Date: 1562456458 2019/07/06 23:40:58 $ 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, @@ -169,6 +169,7 @@ curses: when map window was clipped, the 'scrollbars' shown to indicate which the 2nd and 3rd fifths (for example) were currently within view curses: support users's setting for erase char and kill char when getting a line of input with 'popup_dialog' Off (already supported for popup On) +curses: attempting to use ^H to rush left actually executed ^G (#wizgenesis) curses+'perm_invent': entries were wrapping without any control; usually not noticeable because next entry overwrote, but visible for final entry when whole inventory fit within the available height; looked ok with diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index 7c83ac423..dfca09397 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -661,7 +661,7 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer) goto alldone; case '\177': /* DEL/Rubout */ case KEY_DC: /* delete-character */ - case '\b': /* ^H (Backspace: '\011') */ + case '\b': /* ^H (Backspace: '\010') */ case KEY_BACKSPACE: if (len < 1) { len = 1; diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 5dcbe6d92..4ac85c0a3 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -792,6 +792,13 @@ curses_convert_keys(int key) /* Handle arrow keys */ switch (key) { + case KEY_BACKSPACE: + /* we can't distinguish between a separate backspace key and + explicit Ctrl+H intended to rush to the left; without this, + a value for ^H greater than 255 is passed back to core's + readchar() and stripping the value down to 0..255 yields ^G! */ + ret = C('H'); + break; case KEY_LEFT: if (iflags.num_pad) { ret = '4'; From bac3a75174e261edc176850075231ad81c3a03ae Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 6 Jul 2019 18:14:30 -0700 Subject: [PATCH 4/4] fix #H8164 - kicking altar: injury vs wrath When kicking an altar, trigger divine wrath (minor: luck or alignment loss) before deciding whether hero has hurt himself in the process. Add some variation to the wrath penalty so that it can't be used to precisely control Luck. --- doc/fixes36.3 | 3 ++- src/dokick.c | 4 ++-- src/pray.c | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index e9dd29e5f..d783301bc 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.85 $ $NHDT-Date: 1562456458 2019/07/06 23:40:58 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.86 $ $NHDT-Date: 1562462061 2019/07/07 01:14:21 $ 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, @@ -98,6 +98,7 @@ if an engulfer has any worn items, hero could pick them up from inside and they wouldn't be unworn properly, eventually triggering warnings or worse (Juiblex will wear an amulet if created with one; a shapechanger might wear one and then turn into an engulfer) +kicking an altar ignored god's wrath if hero injured himself during the kick Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/dokick.c b/src/dokick.c index 55df097e5..528b80c28 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dokick.c $NHDT-Date: 1551920353 2019/03/07 00:59:13 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.131 $ */ +/* NetHack 3.6 dokick.c $NHDT-Date: 1562462061 2019/07/07 01:14:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.133 $ */ /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1058,9 +1058,9 @@ dokick() if (Levitation) goto dumb; You("kick %s.", (Blind ? something : "the altar")); + altar_wrath(x, y); if (!rn2(3)) goto ouch; - altar_wrath(x, y); exercise(A_DEX, TRUE); return 1; } diff --git a/src/pray.c b/src/pray.c index d5958ac52..d40bb933c 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pray.c $NHDT-Date: 1561061321 2019/06/20 20:08:41 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.115 $ */ +/* NetHack 3.6 pray.c $NHDT-Date: 1562462064 2019/07/07 01:14:24 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.116 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2226,13 +2226,21 @@ register int x, y; { aligntyp altaralign = a_align(x, y); - if (!strcmp(align_gname(altaralign), u_gname())) { + if (u.ualign.type == altaralign && u.ualign.record > -rn2(4)) { godvoice(altaralign, "How darest thou desecrate my altar!"); (void) adjattrib(A_WIS, -1, FALSE); + u.ualign.record--; } else { - pline("A voice (could it be %s?) whispers:", align_gname(altaralign)); + pline("%s %s%s:", + !Deaf ? "A voice (could it be" + : "Despite your deafness, you seem to hear", + align_gname(altaralign), + !Deaf ? "?) whispers" : " say"); verbalize("Thou shalt pay, infidel!"); - change_luck(-1); + /* higher luck is more likely to be reduced; as it approaches -5 + the chance to lose another point drops down, eventually to 0 */ + if (Luck > -5 && rn2(Luck + 6)) + change_luck(rn2(20) ? -1 : -2); } }