From e0c67f49fcfb01ca5545d0caa69fe6511812f1dd Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 22 Dec 2019 17:22:07 -0800 Subject: [PATCH] fix mysterious force bug Subtracting one dungeon depth value from another had the subtraction backwards and that yielded a negative value where a positive one is expected. If NH_RELEASE_STATUS were to be set to NH_STATUS_RELEASED then this was at risk of crashing (if the bad subtraction yields -2, rn2(diff+2) would divide by 0) since rn2()'s argument isn't validated for released version. fixes37.0 was confused, listing a couple of things that aren't bugs in 3.6 as general fixes. I suspect that the DLB one was fixed before being exposed via git, so shouldn't be there at all. --- doc/fixes37.0 | 10 ++++++---- src/do.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 5d0d80083..a66d896c4 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,8 +1,7 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.29 $ $NHDT-Date: 1577055058 2019/12/22 22:50:58 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.30 $ $NHDT-Date: 1577063925 2019/12/23 01:18:45 $ General Fixes and Modified Features ----------------------------------- -fix compile when DLB isn't defined hero polymorphed into a vampire can use #monster to shape-shift rather than just do a one-shot polymorph into bat/cloud/wolf and shifted vampire hero can use #monster again to take on another form (randomly chosen @@ -14,13 +13,16 @@ function calls made from mapglyph based on dungeon level are now called once per level fix accessing mons[-1] when trying to gate in a non-valid demon fast hero could have random clairvoyance happen more than once on same turn -urealtime.realtime was being incorrectly calculated using 'Q' on wielded weapon would offer to split stack; make using 'w' on a quivered stack behave similarly -Fixes to Pre-3.7.0 Problems that Were Exposed Via git Repository +Fixes to 3.7.0-x Problems that Were Exposed Via git Repository ------------------------------------------------------------------ +fix compile when DLB isn't defined +urealtime.realtime was being incorrectly calculated +revised "mysterious force" when climbing out of gehennom could generate + warnings about "rn2(0) attempted" or "rn2(-n) attempted" Platform- and/or Interface-Specific Fixes diff --git a/src/do.c b/src/do.c index 98a8ff3f2..0f0a08a30 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1576638499 2019/12/18 03:08:19 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.198 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1577063925 2019/12/23 01:18:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.220 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1311,7 +1311,7 @@ boolean at_stairs, falling, portal; if (diff != 0) { assign_rnd_level(newlevel, &u.uz, diff); /* assign_rnd_level() may have used a value less than diff */ - diff = u.uz.dlevel - newlevel->dlevel; /* actual descent */ + diff = newlevel->dlevel - u.uz.dlevel; /* actual descent */ /* if inside the tower, stay inside */ if (was_in_W_tower && !On_W_tower_level(newlevel)) diff = 0;