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
+2 -1
View File
@@ -200,7 +200,8 @@ E NEARDATA struct dig_info { /* apply.c, hack.c */
int effort; int effort;
d_level level; d_level level;
coord pos; coord pos;
boolean down, chew, warned; long lastdigtime;
boolean down, chew, warned, quiet;
} digging; } digging;
E NEARDATA long moves, monstermoves; E NEARDATA long moves, monstermoves;
+16 -3
View File
@@ -353,7 +353,7 @@ dig()
feel_location(dpx, dpy); feel_location(dpx, dpy);
else else
newsym(dpx, dpy); newsym(dpx, dpy);
if(digtxt) pline(digtxt); /* after newsym */ if(digtxt && !digging.quiet) pline(digtxt); /* after newsym */
if(dmgtxt) if(dmgtxt)
pay_for_damage(dmgtxt); pay_for_damage(dmgtxt);
@@ -378,6 +378,8 @@ dig()
newsym(dpx, dpy); newsym(dpx, dpy);
} }
cleanup: cleanup:
digging.lastdigtime = moves;
digging.quiet = FALSE;
digging.level.dnum = 0; digging.level.dnum = 0;
digging.level.dlevel = -1; digging.level.dlevel = -1;
return(0); return(0);
@@ -878,21 +880,32 @@ struct obj *obj;
"chopping at the door", "chopping at the door",
"cutting the tree" "cutting the tree"
}; };
did_dig_msg = FALSE;
digging.quiet = FALSE;
if (digging.pos.x != rx || digging.pos.y != ry || if (digging.pos.x != rx || digging.pos.y != ry ||
!on_level(&digging.level, &u.uz) || digging.down) { !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.down = digging.chew = FALSE;
digging.warned = FALSE; digging.warned = FALSE;
digging.pos.x = rx; digging.pos.x = rx;
digging.pos.y = ry; digging.pos.y = ry;
assign_level(&digging.level, &u.uz); assign_level(&digging.level, &u.uz);
digging.effort = 0; digging.effort = 0;
You("start %s.", d_action[dig_target]); if (!digging.quiet)
You("start %s.", d_action[dig_target]);
} else { } else {
You("%s %s.", digging.chew ? "begin" : "continue", You("%s %s.", digging.chew ? "begin" : "continue",
d_action[dig_target]); d_action[dig_target]);
digging.chew = FALSE; digging.chew = FALSE;
} }
did_dig_msg = FALSE;
set_occupation(dig, "digging", 0); set_occupation(dig, "digging", 0);
} }
} else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) { } else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) {