fix #K3656 - chest in pit
Using #loot while in a pit allows looting containers in that pit. Using open and specifying the hero's spot when not in a pit allows looting containers at hero's spot. But using open while in a pit complained about not being able to reach out of the pit before player had a chance to give hero's spot at the place of interest, so did not allow looting any container there. Get a target spot before rejecting use of 'open' while in a pit. The alternate prompt might be tty-centric.
This commit is contained in:
@@ -1336,6 +1336,8 @@ if the game crashed or the process was killed, recovering a save file ended
|
||||
when using --nethackrc=file on the command line (currently only implemented
|
||||
for ports that use unixmain.c), options parsing freed the string
|
||||
containing 'file' before using it as the RC file name
|
||||
using 'o'pen as a synonym for #loot of a container at the hero's location did
|
||||
not work if the hero was in a pit
|
||||
|
||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||
also included tty support
|
||||
|
||||
@@ -288,7 +288,8 @@ extern int getdir(const char *);
|
||||
extern void confdir(boolean);
|
||||
extern const char *directionname(int);
|
||||
extern int isok(coordxy, coordxy);
|
||||
extern int get_adjacent_loc(const char *, const char *, coordxy, coordxy, coord *);
|
||||
extern int get_adjacent_loc(const char *, const char *, coordxy, coordxy,
|
||||
coord *);
|
||||
extern const char *click_to_cmd(coordxy, coordxy, int);
|
||||
extern char get_count(const char *, char, long, cmdcount_nht *, unsigned);
|
||||
#ifdef HANGUPHANDLING
|
||||
|
||||
24
src/lock.c
24
src/lock.c
@@ -756,6 +756,7 @@ doopen_indir(coordxy x, coordxy y)
|
||||
coord cc;
|
||||
register struct rm *door;
|
||||
boolean portcullis;
|
||||
const char *dirprompt;
|
||||
int res = ECMD_OK;
|
||||
|
||||
if (nohands(g.youmonst.data)) {
|
||||
@@ -763,21 +764,32 @@ doopen_indir(coordxy x, coordxy y)
|
||||
return ECMD_OK;
|
||||
}
|
||||
|
||||
if (u.utrap && u.utraptype == TT_PIT) {
|
||||
You_cant("reach over the edge of the pit.");
|
||||
return ECMD_OK;
|
||||
}
|
||||
dirprompt = NULL; /* have get_adjacent_loc() -> getdir() use default */
|
||||
if (u.utrap && u.utraptype == TT_PIT && container_at(u.ux, u.uy, FALSE))
|
||||
dirprompt = "Open where? [.>]";
|
||||
|
||||
if (x > 0 && y > 0) {
|
||||
if (x > 0 && y >= 0) {
|
||||
/* nonzero <x,y> is used when hero in amorphous form tries to
|
||||
flow under a closed door at <x,y>; the test here was using
|
||||
'y > 0' but that would give incorrect results if doors are
|
||||
ever allowed to be placed on the top row of the map */
|
||||
cc.x = x;
|
||||
cc.y = y;
|
||||
} else if (!get_adjacent_loc((char *) 0, (char *) 0, u.ux, u.uy, &cc))
|
||||
} else if (!get_adjacent_loc(dirprompt, (char *) 0, u.ux, u.uy, &cc)) {
|
||||
return ECMD_OK;
|
||||
}
|
||||
|
||||
/* open at yourself/up/down */
|
||||
if (u_at(cc.x, cc.y))
|
||||
return doloot();
|
||||
|
||||
/* this used to be done prior to get_adjacent_loc() but doing so was
|
||||
incorrect once open at hero's spot became an alternate way to loot */
|
||||
if (u.utrap && u.utraptype == TT_PIT) {
|
||||
You_cant("reach over the edge of the pit.");
|
||||
return ECMD_OK;
|
||||
}
|
||||
|
||||
if (stumble_on_door_mimic(cc.x, cc.y))
|
||||
return ECMD_TIME;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user