option setting, which is reached via the 'O' cmd.)
autodig dig if moving and wielding digging tool [FALSE]
+autoopen walking into a door attempts to open it [TRUE]
autopickup automatically pick up objects you move over [TRUE]
autoquiver when firing with an empty quiver, select some
suitable inventory weapon to fill the quiver [FALSE]
.lp autodig
Automatically dig if you are wielding a digging tool and moving into a place
that can be dug (default false).
+.lp autoopen
+Walking into a door attempts to open it (default true).
.lp "autopickup "
Automatically pick up things onto which you move (default on).
See
Automatically dig if you are wielding a digging tool and moving into a place
that can be dug (default false).
%.lp
+\item[\ib{autoopen}]
+Walking into a door attempts to open it (default true).
+%.lp
\item[\ib{autopickup}]
Automatically pick up things onto which you move (default on).
See ``{\it pickup\_types\/}'' to refine the behavior.
Michael Deutschmann's use_darkgray
Clive Crous' dark_room
sortloot by Jeroen Demeyer and Jukka Lahtinen
+Auto open doors by Stefano Busti
Code Cleanup and Reorganization
boolean bypasses; /* bypass flag is set on at least one fobj */
boolean botl; /* partially redo status line */
boolean botlx; /* print an entirely new bottom line */
+ boolean door_opened; /* set to true if door was opened during test_move */
struct dig_info digging;
struct victual_info victual;
struct tin_info tin;
E boolean FDECL(boxlock, (struct obj *,struct obj *));
E boolean FDECL(doorlock, (struct obj *,int,int));
E int NDECL(doopen);
+E int FDECL(doopen_indir, (int,int));
E int NDECL(doclose);
#ifdef MAC
boolean acoustics; /* allow dungeon sound messages */
boolean autodig; /* MRKR: Automatically dig */
boolean autoquiver; /* Automatically fill quiver */
+ boolean autoopen; /* open doors by walking into them */
boolean beginner;
boolean biff; /* enable checking for mail */
boolean bones; /* allow saving/loading bones */
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
-#define EDITLEVEL 60
+#define EDITLEVEL 61
#define COPYRIGHT_BANNER_A \
"NetHack, Copyright 1985-2015"
register struct rm *tmpr = &levl[x][y];
register struct rm *ust;
+ context.door_opened = FALSE;
/*
* Check for physical obstacles. First, the place we are going.
*/
if (mode == DO_MOVE) {
if (amorphous(youmonst.data))
You("try to ooze under the door, but can't squeeze your possessions through.");
- else if (x == ux || y == uy) {
- if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) {
+ if (flags.autoopen && !context.run && !Confusion && !Stunned && !Fumbling) {
+ context.door_opened = context.move = doopen_indir(x, y);
+ } else if (x == ux || y == uy) {
+ if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) {
if (u.usteed) {
You_cant("lead %s through that closed door.",
y_monnam(u.usteed));
}
if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) {
- context.move = 0;
- nomul(0);
- return;
+ if (!context.door_opened) {
+ context.move = 0;
+ nomul(0);
+ }
+ return;
}
/* Move ball and chain. */
int
doopen() /* try to open a door */
{
+ return doopen_indir(0, 0);
+}
+
+int
+doopen_indir(x, y) /* try to open a door in direction u.dx/u.dy */
+int x, y;
+{
+
coord cc;
register struct rm *door;
struct monst *mtmp;
return 0;
}
- if(!get_adjacent_loc((char *)0, (char *)0, u.ux, u.uy, &cc)) return(0);
+ if (x > 0 && y > 0) {
+ cc.x = x;
+ cc.y = y;
+ } else if(!get_adjacent_loc((char *)0, (char *)0, u.ux, u.uy, &cc)) return(0);
if((cc.x == u.ux) && (cc.y == u.uy)) return(0);
{"asksavedisk", (boolean *)0, FALSE, SET_IN_FILE},
#endif
{"autodig", &flags.autodig, FALSE, SET_IN_GAME},
+ {"autoopen", &flags.autoopen, TRUE, SET_IN_GAME},
{"autopickup", &flags.pickup, TRUE, SET_IN_GAME},
{"autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME},
#if defined(MICRO) && !defined(AMIGA)