[net.sources.games] More HACK bug fixes

jgm@cmu-cs-h.ARPA (John Myers) (04/26/85)

The following are descriptions to some bugs I found in HACK v1.0.2 and
their respective fixes.

-----
If someone on levels 30 to 39 takes off his ring of fire resistance, all
is well until he goes up to the next level.  This should not be the case.

hack.do_wear.c
-----
>ringoff(obj)
>register struct obj *obj;
>{
>register long mask;
>	mask = obj->owornmask & W_RING;
>	setworn((struct obj *) 0, obj->owornmask);
>	if(!(u.uprops[PROP(obj->otyp)].p_flgs & mask))
>		impossible("Strange... I didnt know you had that ring.");
>	u.uprops[PROP(obj->otyp)].p_flgs &= ~mask;
>	switch(obj->otyp) {
*	/* Bad luck if the player is in hell... --jgm */
*	case RIN_FIRE_RESISTANCE:
*		if (!Fire_resistance && dlevel >= 30) {
*			pline("The flames of Hell burn you to a crisp.");
*			killer = "stupidity in hell";
*			done("burned");
*		}
*		break;
*        /* end jgm */
>	case RIN_LEVITATION:
-----
If someone tames a trapper while he is being digested, HACK will sometimes
bomb in dog_move() when it tries to take rnd(udist) (udist==0).

hack.dog.c, tamedog()
-----
	/* If we cannot tame him, at least he's no longer afraid. */
	mtmp->mflee = 0;
	mtmp->mfleetim = 0;
	if(mtmp->mtame || mtmp->mfroz ||
#ifndef NOWORM
		mtmp->wormno ||
#endif NOWORM
		/* Make sure he's not swallowing you --jgm */
		(u.uswallow && mtmp == u.ustuck) ||
		/* end jgm */

		mtmp->isshk || mtmp->isgd)
		return(0); /* no tame long worms? */
-----
When saving games,  HACK doesn't get rid of the level file for the current
level.

hack.save.c, dosave0()
-----
>		bwrite(fd, (char *) &tmp, sizeof tmp);	/* level number */
>		savelev(fd,tmp);			/* actual level */
>		(void) unlink(lock);
>	}
*	/* Get rid of the level file for the current level --jgm */
*	glo(dlevel);
*	(void) unlink(lock);
*	/* end jgm */
>
>	(void) close(fd);
>	{ register char *lp = index(lock, '.');
>	  if(lp) *lp = 0;
>	  (void) unlink(lock);
>	}
-----
It is possible to teleport onto pools.  While it seems this was intended,
I do not think it is fair to be killed by a random teleport.  Actually, when
someone does teleport on top of a pool, he does not die, but instead walks
on the water.

hack.trap.c
-----
>teleok(x,y) register int x,y; {	/* might throw him into a POOL */
>	return( isok(x,y) && !IS_ROCK(levl[x][y].typ) && !m_at(x,y) &&
>		!sobj_at(ENORMOUS_ROCK,x,y) && !t_at(x,y)
*/* Don't teleport onto pools --jgm */
*		&& levl[x][y].typ != POOL
*/* end jgm */
>	);
>	/* Note: gold is permitted (because of vaults) */
>}
-----
It is possible to polymorph your dog into a long worm.  This massively
mucks up the movement code.

hack.zap.c, bhitm()
-----
>	case WAN_POLYMORPH:
*		/* Don't polymorph our dog into a worm! --jgm */
*		{ struct permonst *newmon;
*		do {
*		    newmon = &mons[rn2(CMNUM)];
*		} while (mtmp->mtame && newmon->mlet == 'w');
*		if( newcham(mtmp,newmon) )
*		/* end jgm */
>			objects[otmp->otyp].oc_name_known = 1;
*		}
>		break;
>	case WAN_CANCELLATION:
-----

aeb@mcvax.UUCP (Andries Brouwer) (04/27/85)

John Myers indicated some bug fixes and mods - most of them
are appropriate, but I am not sure I like the solution for
the (very minor) problems he indicated with taming and polymorphing.

Taming a trapper while being swallowed is one way of obtaining
udist==0 in dogmove() - perhaps there are other ways. Instead of
forbidding to tame monsters in such a situation it seems more
logical to put a statement
	if(udist == 0) return(0);
in dog_move().

Polymorphing your dog into a worm is one way of obtaining a tame worm -
perhaps there are other ways - what about polymorphing it into a
chameleon that subsequently starts mimicking a worm? I haven't
checked but John may well be right that having tame worms gives
problems in the movement routines, but if that is the case it seems
to me that the straightforward solution would be to put
	if(mtmp->wormno) goto not_special;
in m_move() (hack.mon.c)
where not_special is a label after the tests for dogs, shopkeepers, guards,
tengus, umber hulks and whatever else needs a special treatment.

Of course the real bug is that all code in hack.dog.c was written
at a time where the dog was the only monster that could be tame(d).
Vampires going for tripe rations are a bit ridiculous. We'll have
to invent a suitable behaviour for tame monsters different from dogs.