]> granicus.if.org Git - nethack/commitdiff
autodig chattiness
authorcohrs <cohrs>
Sun, 27 Jan 2002 23:45:47 +0000 (23:45 +0000)
committercohrs <cohrs>
Sun, 27 Jan 2002 23:45:47 +0000 (23:45 +0000)
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.

include/decl.h
src/dig.c

index b38b53d56cc74cf47af06d9080babfcec5f58468..5a0a32e981169bb7b02f303b961060327255c2ff 100644 (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;
index 740f1d66c0747b11491b4abaefc03feb74f03f7e..e73bf1e2baf45dd3ce642d8ccc7e6fcd942a21c4 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -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)) {