[net.sources.games] Missing dog bug in HACK 1.02, 1.03

kneller@ucsfcgl.UUCP (Don Kneller%Langridge) (09/08/85)

Did you ever have a game where it seems like you didn't start with a
dog?  There is a bug in hack.main.c which results in the dog not being
created if mklev() created a monster on the level 1 stairway (which is
also where you are standing when you start a game).  A subsequent call
to makedog() fails because it calls makemon() to create a dog on the
same spot the monster is already on.  Makemon() returns 0 and makedog()
interprets the 0 to mean dogs have been genocided.

Anyway, the context diff follows.

*** hack.main.old	Sat Sep  7 16:09:00 1985
--- hack.main.c	Sat Sep  7 17:06:29 1985
***************
*** 261,268 ****
--- 261,278 ----
---------------
  		u.uy = yupstair;
  		(void) inshop();
  		setsee();
  		flags.botlx = 1;
+>		{
+>			register struct monst *mtmp;
+>
+>			/* Move the monster from under you or else
+>			 * makedog() will fail when it calls makemon().
+>			 * 			- ucsfcgl!kneller
+>			 */
+>			if (mtmp = m_at(u.ux, u.uy))
+>				mnexto(mtmp);
+>		}
  		makedog();
  		{ register struct monst *mtmp;
  		  if(mtmp = m_at(u.ux, u.uy)) mnexto(mtmp);	/* riv05!a3 */
  		}

By the way, the code following the line
		makedog();
now does nothing since the dog is created beside you.
Since it is the same code as I have put in above makedog()
to fix this bug, perhaps makedog() was accidentally moved in
the author's sources.

	Don Kneller
UUCP:	...ucbvax!ucsfcgl!kneller
ARPA:	ucsfcgl!kneller@Berkeley.ARPA