autodig chattiness

The autodig code still requires lots of interaction, because of all the
digging messages.  Make these messages behave more like boulder pushing
messages, where they only display if the previous move wasn't a push.
This commit is contained in:
cohrs
2002-01-27 23:45:47 +00:00
parent ad2e81c296
commit 00cfa4a9f8
2 changed files with 18 additions and 4 deletions

View File

@@ -200,7 +200,8 @@ E NEARDATA struct dig_info { /* apply.c, hack.c */
int effort;
d_level level;
coord pos;
boolean down, chew, warned;
long lastdigtime;
boolean down, chew, warned, quiet;
} digging;
E NEARDATA long moves, monstermoves;

View File

@@ -353,7 +353,7 @@ dig()
feel_location(dpx, dpy);
else
newsym(dpx, dpy);
if(digtxt) pline(digtxt); /* after newsym */
if(digtxt && !digging.quiet) pline(digtxt); /* after newsym */
if(dmgtxt)
pay_for_damage(dmgtxt);
@@ -378,6 +378,8 @@ dig()
newsym(dpx, dpy);
}
cleanup:
digging.lastdigtime = moves;
digging.quiet = FALSE;
digging.level.dnum = 0;
digging.level.dlevel = -1;
return(0);
@@ -878,21 +880,32 @@ struct obj *obj;
"chopping at the door",
"cutting the tree"
};
did_dig_msg = FALSE;
digging.quiet = FALSE;
if (digging.pos.x != rx || digging.pos.y != ry ||
!on_level(&digging.level, &u.uz) || digging.down) {
if (flags.autodig && !dig_target && !digging.down &&
digging.pos.x == u.ux &&
digging.pos.y == u.uy &&
(moves <= digging.lastdigtime+2 &&
moves >= digging.lastdigtime)) {
/* avoid messages if repeated autodigging */
did_dig_msg = TRUE;
digging.quiet = TRUE;
}
digging.down = digging.chew = FALSE;
digging.warned = FALSE;
digging.pos.x = rx;
digging.pos.y = ry;
assign_level(&digging.level, &u.uz);
digging.effort = 0;
You("start %s.", d_action[dig_target]);
if (!digging.quiet)
You("start %s.", d_action[dig_target]);
} else {
You("%s %s.", digging.chew ? "begin" : "continue",
d_action[dig_target]);
digging.chew = FALSE;
}
did_dig_msg = FALSE;
set_occupation(dig, "digging", 0);
}
} else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) {