From 1c545eb678b31ccbfb35885855b8ea7358e90fdf Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Fri, 3 Aug 2007 01:49:33 +0000 Subject: [PATCH] drawbridge feedback (trunk only) The open and close commands had some feedback when player attempted to use them on a drawbridge, but they didn't handle all the permutations. --- doc/fixes35.0 | 2 ++ src/lock.c | 29 ++++++++++++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index a563d81f6..761e33c96 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -261,6 +261,8 @@ require confirmation to read a scroll of mail if doing so will be the first using F to force an attack towards a boulder gave "you attack thin air" random "treasure drop" upon monster's death bypassed dropping side-effects melted ice on Valkyrie quest should be pool, not moat +some variations of attempting to use open or close commands on a drawbridge + didn't give drawbridge-specific feedback Platform- and/or Interface-Specific Fixes diff --git a/src/lock.c b/src/lock.c index 4483d5c8f..2359771a1 100644 --- a/src/lock.c +++ b/src/lock.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)lock.c 3.5 2007/02/17 */ +/* SCCS Id: @(#)lock.c 3.5 2007/08/02 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -522,6 +522,7 @@ doopen() /* try to open a door */ coord cc; register struct rm *door; struct monst *mtmp; + boolean portcullis; if (nohands(youmonst.data)) { You_cant("open anything -- you have no hands!"); @@ -548,14 +549,16 @@ doopen() /* try to open a door */ } door = &levl[cc.x][cc.y]; + portcullis = (is_drawbridge_wall(cc.x, cc.y) >= 0); - if(!IS_DOOR(door->typ)) { - if (is_db_wall(cc.x,cc.y)) { + if (portcullis || !IS_DOOR(door->typ)) { + /* closed portcullis or spot that opened bridge would span */ + if (is_db_wall(cc.x, cc.y) || door->typ == DRAWBRIDGE_UP) There("is no obvious way to open the drawbridge."); - return(0); - } - You("%s no door there.", - Blind ? "feel" : "see"); + else if (portcullis || door->typ == DRAWBRIDGE_DOWN) + pline_The("drawbridge is already open."); + else + You("%s no door there.", Blind ? "feel" : "see"); return(0); } @@ -629,6 +632,7 @@ doclose() /* try to close a door */ register int x, y; register struct rm *door; struct monst *mtmp; + boolean portcullis; if (nohands(youmonst.data)) { You_cant("close anything -- you have no hands!"); @@ -660,13 +664,16 @@ doclose() /* try to close a door */ } door = &levl[x][y]; + portcullis = (is_drawbridge_wall(x, y) >= 0); - if(!IS_DOOR(door->typ)) { - if (door->typ == DRAWBRIDGE_DOWN) + if (portcullis || !IS_DOOR(door->typ)) { + /* is_db_wall: closed porcullis */ + if (is_db_wall(x, y) || door->typ == DRAWBRIDGE_UP) + pline_The("drawbridge is already closed."); + else if (portcullis || door->typ == DRAWBRIDGE_DOWN) There("is no obvious way to close the drawbridge."); else - You("%s no door there.", - Blind ? "feel" : "see"); + You("%s no door there.", Blind ? "feel" : "see"); return(0); }