fix github issue #581 - "You see no door there."

Year old issue from copperwater:  'open' directed at a non-door told
player that there isn't a door and took no time unless character was
blind and learned what type of terrain it is, applying a key gave
the same message but used a turn and didn't update map to reflect any
terrain discovery.

Attempting to open an adjacent door or applying a key to one while in
a pit had a similar issue:  they produced the same "you can't reach
it from here" but had different time vs no-time outcome.

There may be other actions in the same situation.

Closes #581
This commit is contained in:
PatR
2022-09-23 15:30:00 -07:00
parent e5714b7161
commit f9e5e4966a
2 changed files with 28 additions and 9 deletions

View File

@@ -1024,6 +1024,11 @@ room stocking would put multiple items on the same spot
splitting a stack of named, shop-owned objects while perm_invent is enabled
produced impossible "unpaid_cost: object wasn't on any bill."
more consistent feedback if a reviving corpse becomes an unseen monster
improve consistency between applying a key and explicitly opening a door:
if in a pit, you're told "you can't" and no time elapses; if there
isn't any door in the direction supplied, you're told "no door" and
time elapses if you discover the non-door's terrain type but doesn't
if you already knew the type there
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -341,9 +341,9 @@ autokey(boolean opening) /* True: key, pick, or card; False: key or pick */
DISABLE_WARNING_FORMAT_NONLITERAL
/* for doapply(); if player gives a direction or resumes an interrupted
previous attempt then it costs hero a move even if nothing ultimately
happens; when told "can't do that" before being asked for direction
or player cancels with ESC while giving direction, it doesn't */
previous attempt then it usually costs hero a move even if nothing
ultimately happens; when told "can't do that" before being asked for
direction or player cancels with ESC while giving direction, it doesn't */
#define PICKLOCK_LEARNED_SOMETHING (-1) /* time passes */
#define PICKLOCK_DID_NOTHING 0 /* no time passes */
#define PICKLOCK_DID_SOMETHING 1
@@ -353,8 +353,8 @@ int
pick_lock(
struct obj *pick,
coordxy rx, coordxy ry, /* coordinates of door/container, for autounlock:
* does not prompt for direction if these are set */
struct obj *container) /* container, for autounlock */
* doesn't prompt for direction if these are set */
struct obj *container) /* container, for autounlock */
{
struct obj dummypick;
int picktyp, c, ch;
@@ -535,12 +535,16 @@ pick_lock(
There("doesn't seem to be any sort of lock here.");
return PICKLOCK_LEARNED_SOMETHING; /* decided against all boxes */
}
} else { /* pick the lock in a door */
/* not the hero's location; pick the lock in an adjacent door */
} else {
struct monst *mtmp;
if (u.utrap && u.utraptype == TT_PIT) {
You_cant("reach over the edge of the pit.");
return PICKLOCK_LEARNED_SOMETHING;
/* this used to return PICKLOCK_LEARNED_SOMETHING but the
#open command doesn't use a turn for similar situation */
return PICKLOCK_DID_NOTHING;
}
door = &levl[cc.x][cc.y];
@@ -562,11 +566,20 @@ pick_lock(
return PICKLOCK_LEARNED_SOMETHING;
}
if (!IS_DOOR(door->typ)) {
int res = PICKLOCK_DID_NOTHING, oldglyph = door->glyph;
schar oldlastseentyp = g.lastseentyp[cc.x][cc.y];
/* this is probably only relevant when blind */
feel_location(cc.x, cc.y);
if (door->glyph != oldglyph
|| g.lastseentyp[cc.x][cc.y] != oldlastseentyp)
res = PICKLOCK_LEARNED_SOMETHING;
if (is_drawbridge_wall(cc.x, cc.y) >= 0)
You("%s no lock on the drawbridge.", Blind ? "feel" : "see");
else
You("%s no door there.", Blind ? "feel" : "see");
return PICKLOCK_LEARNED_SOMETHING;
return res;
}
switch (door->doormask) {
case D_NODOOR:
@@ -800,7 +813,8 @@ doopen_indir(coordxy x, coordxy y)
door = &levl[cc.x][cc.y];
portcullis = (is_drawbridge_wall(cc.x, cc.y) >= 0);
if (Blind) {
/* this used to be 'if (Blind)' but using a key skips that so we do too */
{
int oldglyph = door->glyph;
schar oldlastseentyp = g.lastseentyp[cc.x][cc.y];