Subject: NH311 Patch: Digging

From: "Michael & Heather Gleason" <[email-masked]>
Date: Wed, 29 Aug 2001 15:43:45 GMT

What this patch does:
==============

My style of play uses a lot of digging.  In order to make cutting wide
swaths into the dungeon rock easier, I've added a dig command, which uses
the logically chosen "-" key (as in subtracting rock).  If you have a pick
axe or mattock in your inventory, you can now press "-" to start digging.
As a consequence, it also removes the alias to the "F" command, but since
you can still just press "F", I don't see that as a problem.

Something I decided not to include in this patch, is a change where any key
can be pressed at the "--More--" prompt.  I figure the DevTeam prefers that
you press Space.  I have this in my copy, so I can really make progress by
simply banging away on the keypad.  (Or, mow through a military barracks by
simply holding down a direction key.)

How to use these modifications:
======================
To apply the patch under a *NIX OS do the following:
(1) Download the source code tarball, available from
<ftp://ftp.nethack.org/pub/nethack/nh331/src/nethack-331.tgz> .
(2) Extract the tar ball, i.e. "gzip -d -c nethack-331.tgz | tar xf -" .
(3) Change directory to the nethack-3.3.1 directory that Tar created.
(4) Save this patch file into this directory, i.e. "patch.txt" .
(5) Run patch, i.e. "patch -p1 < patch.txt" .
(6) Follow Nethack's installation instructions to compile and install
Nethack.

Enjoy!
Mike Gleason from NcFTP

diff -u -r nethack-3.3.1/include/extern.h nethack-3.3.1-dig/include/extern.h
--- nethack-3.3.1/include/extern.h	Wed Aug  9 10:46:17 2000
+++ nethack-3.3.1-dig/include/extern.h	Wed Aug 29 08:57:18 2001
@@ -222,6 +222,7 @@
 E boolean FDECL(dig_check, (struct monst *, BOOLEAN_P, int, int));
 E void FDECL(digactualhole, (int,int,struct monst *,int));
 E boolean FDECL(dighole, (BOOLEAN_P));
+E int NDECL(dodig);
 E int FDECL(use_pick_axe, (struct obj *));
 E boolean FDECL(mdig_tunnel, (struct monst *));
 E void NDECL(zap_dig);
diff -u -r nethack-3.3.1/include/trampoli.h nethack-3.3.1-dig/include/trampoli.h
--- nethack-3.3.1/include/trampoli.h	Sat Nov 13 20:30:31 1999
+++ nethack-3.3.1-dig/include/trampoli.h	Wed Aug 29 08:57:18 2001
@@ -36,6 +36,11 @@
 #define wiz_wish()	   wiz_wish_()
 #endif
 
+
+/* ### dig.c ### */
+#define dodig() dodig_()
+
+
 /* ### display.c ### */
 #define doredraw() doredraw_()
 
diff -u -r nethack-3.3.1/src/cmd.c nethack-3.3.1-dig/src/cmd.c
--- nethack-3.3.1/src/cmd.c	Fri Jul 21 19:59:03 2000
+++ nethack-3.3.1-dig/src/cmd.c	Wed Aug 29 08:57:18 2001
@@ -25,6 +25,7 @@
 
 #ifdef DUMB	/* stuff commented out in extern.h, but needed here */
 extern int NDECL(doapply); /**/
+extern int NDECL(dodig); /**/
 extern int NDECL(dorub); /**/
 extern int NDECL(dojump); /**/
 extern int NDECL(doextlist); /**/
@@ -1262,6 +1263,7 @@
 	{';', TRUE, doquickwhatis},
 	{'^', TRUE, doidtrap},
 	{'\\', TRUE, dodiscovered},		/* Robert Viduya */
+	{'-', FALSE, dodig},			/* Mike Gleason */
 	{'@', TRUE, dotogglepickup},
 	{M('2'), FALSE, dotwoweapon},
 	{WEAPON_SYM,  TRUE, doprwep},
@@ -1603,7 +1605,6 @@
 		    } else
 			prefix_seen = TRUE;
 		    break;
-	 case '-':  if (!iflags.num_pad) break;	/* else FALLTHRU */
 	/* Effects of movement commands and invisible monsters:
 	 * m: always move onto space (even if 'I' remembered)
 	 * F: always attack space (even if 'I' not remembered)
@@ -1901,7 +1902,7 @@
 	in_line[0] = foo;
 	in_line[1] = '\0';
 	if (foo == 'g' || foo == 'G' || foo == 'm' || foo == 'M' ||
-	    foo == 'F' || (iflags.num_pad && (foo == '5' || foo == '-'))) {
+	    foo == 'F' || (iflags.num_pad && foo == '5')) {
 	    foo = readchar();
 #ifdef REDO
 	    savech((char)foo);
diff -u -r nethack-3.3.1/src/dig.c nethack-3.3.1-dig/src/dig.c
--- nethack-3.3.1/src/dig.c	Sun Jul 16 19:16:27 2000
+++ nethack-3.3.1-dig/src/dig.c	Wed Aug 29 09:09:00 2001
@@ -235,6 +235,7 @@
 			   uwep->spe - greatest_erosion(uwep) + u.udaminc;
 	if (Race_if(PM_DWARF))
 	    digging.effort *= 2;
+
 	if (digging.down) {
 		register struct trap *ttmp;
 
@@ -738,6 +739,25 @@
 	newsym(u.ux,u.uy);
 	return;
 }
+
+int
+dodig()
+{
+	struct obj *obj;
+
+	obj = carrying(PICK_AXE);
+	if (obj == NULL)
+		obj = carrying(DWARVISH_MATTOCK);
+
+	if (obj == NULL) {
+		pline("You don't have anything to dig with.");
+		return 0;
+	}
+
+	return (use_pick_axe(obj));
+}	/* dodig */
+
+
 
 int
 use_pick_axe(obj)
diff -u -r nethack-3.3.1/sys/winnt/nttty.c nethack-3.3.1-dig/sys/winnt/nttty.c
--- nethack-3.3.1/sys/winnt/nttty.c	Thu Aug  3 15:50:51 2000
+++ nethack-3.3.1-dig/sys/winnt/nttty.c	Wed Aug 29 08:57:18 2001
@@ -208,22 +208,22 @@
 			{'b', 'B', C('b')},		/* 1 */
 			{'j', 'J', C('j')},		/* 2 */
 			{'n', 'N', C('n')},		/* 3 */
-			{'i', 'I', C('i')},		/* Ins */
+			{'o', 'o', 'o'},		/* Ins (0) */
 			{'.', ':', ':'}			/* Del */
 }, numpad[PADKEYS] = {
 			{'7', M('7'), '7'},		/* 7 */
 			{'8', M('8'), '8'},		/* 8 */
 			{'9', M('9'), '9'},		/* 9 */
-			{'m', C('p'), C('p')},		/* - */
+			{'-', C('p'), C('p')},		/* - */
 			{'4', M('4'), '4'},		/* 4 */
-			{'g', 'G', 'g'},		/* 5 */
+			{'G', 'g', 'G'},		/* 5 */
 			{'6', M('6'), '6'},		/* 6 */
 			{'p', 'P', C('p')},		/* + */
 			{'1', M('1'), '1'},		/* 1 */
 			{'2', M('2'), '2'},		/* 2 */
 			{'3', M('3'), '3'},		/* 3 */
-			{'i', 'I', C('i')},		/* Ins */
-			{'.', ':', ':'}			/* Del */
+			{'o', 'o', 'o'},		/* Ins (0) */
+			{'.', ':', ':'}			/* Del (.) */
 };
 /*
  * Unlike Ctrl-letter, the Alt-letter keystrokes have no specific ASCII