[net.games.rogue] Nymph bug fix for 5.3

laman@sdcsvax.UUCP (Mike Laman) (10/07/84)

Now that I have you attention...

There was a fix that was posted a month or so ago.  As someone quickly pointed
out, it doesn't work.  I agree.  Snooping around in "leave_pack()" with "adb"
IS TUFF!  His interpretation of the arguments were partially correct and
partially incorrect.  The first of three arguments to "leave_pack()" is a
pointer to the object to remove (it contains a count and so it may represent
several objects like 3 potions or 15 arrows).  The second argument is a flag
saying to return a SEPARATE COPY if we have a multiple count and the third
argument is zero.   The third (and last) argument seems to be a flag saying
whether to consider the object as an unbreakable pack or as a separable
bunch.

The proposed fix was "leave_pack(ptr, 0, 1);".  This is INCORRECT!  Looking
into "attack()" where the Nymph has struck, one sees that after the call
to "leave_pack()" there is a call to "discard(ptr)".  "Discard(ptr)"
calls "cfree()" with the given pointer.  The point here is that when the
nymph hits and takes something from you, the pointer passed to "cfree()",
so the area had better be OUT of the players pack!  What we want is:

	ptr = leave_pack(ptr, 1, 0);

This means TWO assembly instructions will need to be added into "attack()".
If you don't mind wasting space, NO-OP the call to "discard()" in "attack()"
that follows the call to "leave_pack()" and just make the call to
"leave_pack()" as "leave_pack(ptr, 1, 0);" instead of "leave_pack(ptr, 0, 0)"
as it is distributed.  [ That call to discard is a bunch of instruction
farther down! ]

This is not the real fix.  I think the REAL fix would be:

	ptr = leave_pack(ptr, 1, (ptr->offset8 != ':') &&
				(ptr->offset8 != '?') && (ptr->offset8 != '!'));

	[ Go ahead. Make my day.  Figure out a patch to get the
	  third argument! ]

I think this is it because:

	1. We have the call to "discard()", so we need the pointer pointing at
	   an area to free, so we need both the second argument to
	   "leave_pack()" to be "1" (so we get a copy in case we want to
	   remove just ONE of bunch of objects) and the return value to get the
	   new area as previously mentioned.  [ "leave_pack()" returns a
	   pointer to the new area or the original area depending on the
	   situation. ]

	2. The funny third argument says that the Nymph can only take ONE
	   scroll, potion, or one piece of food.  But it can take more than
	   on arrow, dart, rock... or anything else that gets bunched together
	   in the player's pack.

Happy patching...

		Mike Laman
		UUCP: {ucbvax,philabs,sdcsla}!sdcsvax!laman