fix githib issue #179 - random drawbridge state

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).
This commit is contained in:
PatR
2019-03-28 08:40:40 -07:00
parent 4867badd61
commit 81d755a9e0
3 changed files with 16 additions and 6 deletions

View 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;