From 355dec4d842a261ad8dfbdb0ac5748eb3f7c12af Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 13 Jan 2019 15:17:40 -0800 Subject: [PATCH] blocking or unblocking levitation or flight when level teleporting or digging. Level teleporting while levitation was blocked due to being inside solid rock didn't notice that it should be unblocked until you moved from whatever type of terrain you landed on (room, for instance) to some other type (such as corridor). Digging down to make a pit or hole while inside solid rock converts that spot to floor so should also check whether to unblock levitation/flying, and not fall if unblocking occurs. --- doc/fixes36.2 | 4 +++- src/dig.c | 19 ++++++++++++++++--- src/dungeon.c | 7 +++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 9b01667ad..b63630534 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.228 $ $NHDT-Date: 1547343820 2019/01/13 01:43:40 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.229 $ $NHDT-Date: 1547421445 2019/01/13 23:17:25 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -266,6 +266,8 @@ when blocking/unblocking of levitation or flying was updated due to walking if levitating hero in pass-wall creature form jumped or teleported from terrain that allowed levitation to terrain that didn't or vice versa, blocking of levitation wasn't updated properly +digging down or level teleporting while stuck in solid rock which is blocking + levitation or flight didn't notice when that should become unblocked make it easier to clear 'pickup_types' (menustyles Traditional and Combination could do so by setting it to 'a'; now ' ' works too; Full and Partial allowed unselecting every object class; now 'all classes' is a choice) diff --git a/src/dig.c b/src/dig.c index 29d0941d4..dbf5eb5ca 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dig.c $NHDT-Date: 1544442710 2018/12/10 11:51:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.116 $ */ +/* NetHack 3.6 dig.c $NHDT-Date: 1547421446 2019/01/13 23:17:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.117 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -612,10 +612,16 @@ int ttyp; You("dig a pit in the %s.", surface_type); if (shopdoor) pay_for_damage("ruin", FALSE); - } else if (!madeby_obj && canseemon(madeby)) + } else if (!madeby_obj && canseemon(madeby)) { pline("%s digs a pit in the %s.", Monnam(madeby), surface_type); - else if (cansee(x, y) && flags.verbose) + } else if (cansee(x, y) && flags.verbose) { pline("A pit appears in the %s.", surface_type); + } + /* in case we're digging down while encased in solid rock + which is blocking levitation or flight */ + switch_terrain(); + if (Levitation || Flying) + wont_fall = TRUE; if (at_u) { if (!wont_fall) { @@ -644,6 +650,13 @@ int ttyp; pline("A hole appears in the %s.", surface_type); if (at_u) { + /* in case we're digging down while encased in solid rock + which is blocking levitation or flight */ + switch_terrain(); + if (Levitation || Flying) + wont_fall = TRUE; + + /* check for leashed pet that can't fall right now */ if (!u.ustuck && !wont_fall && !next_to_u()) { You("are jerked back by your pet!"); wont_fall = TRUE; diff --git a/src/dungeon.c b/src/dungeon.c index 335ca15da..6df9fda37 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1,4 +1,4 @@ -/* 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: 1547421449 2019/01/13 23:17:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.90 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1202,7 +1202,7 @@ int x, y; 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; @@ -1230,6 +1230,9 @@ 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 */ -- 2.40.0