]> granicus.if.org Git - nethack/commitdiff
fix githib issue #179 - random drawbridge state
authorPatR <rankin@nethack.org>
Thu, 28 Mar 2019 15:40:40 +0000 (08:40 -0700)
committerPatR <rankin@nethack.org>
Thu, 28 Mar 2019 15:40:40 +0000 (08:40 -0700)
Fixes #179

The Valkyrie goal level has two drawbridges and one of them was set to
have 50:50 chance to be closed (raised).  But 'random' for drawbridge
open/closed (or lowered/raised) state was always choosing open (lowered).
This fixes that and also changes that level to have the old settings
(southern open, northern 50:50) for 75% of the time and new settings
(both 50:50) for 25% of the time.  So there's now a 12.5% chance that
both will be closed instead of both always being open (due to the bug
with handling random).

dat/Valkyrie.des
doc/fixes36.2
src/sp_lev.c

index 21541ab0a893625b9ee5dfd9d816ece762e764c1..ebae19526631cebdcab7d93da789291b6509f2c5 100644 (file)
@@ -1,4 +1,4 @@
-# NetHack 3.6  Valkyrie.des    $NHDT-Date: 1432512783 2015/05/25 00:13:03 $  $NHDT-Branch: master $:$NHDT-Revision: 1.13 $
+# NetHack 3.6  Valkyrie.des    $NHDT-Date: 1553787633 2019/03/28 15:40:33 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.14 $
 #      Copyright (c) 1989 by Jean-Christophe Collet
 #      Copyright (c) 1991-2 by M. Stephenson
 # NetHack may be freely redistributed.  See license for details.
@@ -216,9 +216,13 @@ REGION:(00,00,34,16),lit,"ordinary"
 STAIR:(45,10),up
 # Non diggable walls
 NON_DIGGABLE:(00,00,34,16)
-# Drawbridges
+# Drawbridges; northern one opens to the south, southern one to the north
 DRAWBRIDGE:(17,02),south,random
-DRAWBRIDGE:(17,14),north,open
+IF [75%] {
+   DRAWBRIDGE:(17,14),north,open
+} ELSE {
+   DRAWBRIDGE:(17,14),north,random
+}
 # Objects
 OBJECT:('(',"crystal ball"),(17,08),blessed,5,name:"The Orb of Fate"
 OBJECT:random,random
index 9439ab4d380e99551e5b65ec44ae37050dde4460..66de6f54dff90c194b0decfdc50c1a3c2c03466c 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.285 $ $NHDT-Date: 1553653612 2019/03/27 02:26:52 $
+$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.286 $ $NHDT-Date: 1553787633 2019/03/28 15:40:33 $
 
 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,
@@ -398,6 +398,9 @@ avoid spurious status refresh when hero gains experience while 'showexp' and
        'showscore' options are off
 using Cleaver to attack a worm tail segment but kill adjacent head first would
        result in an impossible warning from cutworm
+Valkyrie quest was supposed to have a 50:50 chance that northern drawbridge
+       would be raised, but both were always lowered; chances now are: both
+       lowered: 3/8, S down+N up: 3/8, N down+S up: 1/8, both raised: 1/8
 
 
 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
index ded755317f306ba51ebeea4a32d203326732e230..cd952108c6014e9440c93b0b762cc1458f7b3c8b 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 sp_lev.c        $NHDT-Date: 1550524566 2019/02/18 21:16:06 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.110 $ */
+/* NetHack 3.6 sp_lev.c        $NHDT-Date: 1553787633 2019/03/28 15:40:33 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.111 $ */
 /*      Copyright (c) 1989 by Jean-Christophe Collet */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -4711,13 +4711,16 @@ struct sp_coder *coder;
 {
     static const char nhFunc[] = "spo_drawbridge";
     xchar x, y;
+    int dopen;
     struct opvar *dir, *db_open, *dcoord;
 
     if (!OV_pop_i(dir) || !OV_pop_i(db_open) || !OV_pop_c(dcoord))
         return;
 
     get_location_coord(&x, &y, DRY | WET | HOT, coder->croom, OV_i(dcoord));
-    if (!create_drawbridge(x, y, OV_i(dir), OV_i(db_open)))
+    if ((dopen = OV_i(db_open)) == -1)
+        dopen = !rn2(2);
+    if (!create_drawbridge(x, y, OV_i(dir), dopen ? TRUE : FALSE))
         impossible("Cannot create drawbridge.");
     SpLev_Map[x][y] = 1;