[net.games.hack] Inventory Fix in mkobj.c

arnold@ucsfcgl.UUCP (Ken Arnold%CGL) (06/23/85)

The following is a minor fix to hack.  I finally got tired of having
multiple groups of the same kind of food, which makes keeping track
of things difficult.  The problem was that certain fields were not getting
initialized, so the "spe" field, especially, was different for different
pieces of food, even though the field isn't used for food.  The following
is the fix, as a context diff (as all hack updates should come).

----- CUT HERE -----
*** /tmp/,RCSt1006751	Sat Jun 22 17:49:55 1985
--- hack.mkobj.c	Sat Jun 22 17:40:41 1985
***************
*** 56,61
  	otmp->age = moves;
  	otmp->o_id = flags.ident++;
  	otmp->quan = 1;
  	otmp->olet = let;
  	otmp->otyp = otyp;
  	otmp->dknown = index("/=!?*", let) ? 0 : 1;

--- 56,65 -----
  	otmp->age = moves;
  	otmp->o_id = flags.ident++;
  	otmp->quan = 1;
+ 	otmp->spe = 0;
+ 	otmp->known = 0;
+ 	otmp->dknown = 0;
+ 	otmp->cursed = 0;
  	otmp->olet = let;
  	otmp->otyp = otyp;
  	otmp->dknown = index("/=!?*", let) ? 0 : 1;

aeb@mcvax.UUCP (Andries Brouwer) (06/26/85)

In article <553@ucsfcgl.UUCP> arnold@ucsfcgl.UUCP () writes:
>
>The following is a minor fix to hack.  I finally got tired of having
>multiple groups of the same kind of food, which makes keeping track
>of things difficult.  The problem was that certain fields were not getting
>initialized, so the "spe" field, especially, was different for different
>pieces of food, even though the field isn't used for food.  The following
>is the fix, as a context diff (as all hack updates should come).

I see no harm in this fix, but no advantage either. Just before
the lines quoted in the context diff is the line (mkobj.c line 55 in V1.0.2)
	*otmp = zeroobj;
that initializes all fields to zero; so the behaviour with and without
the fix will be completely identical.

arnold@ucsfcgl.UUCP (Ken Arnold%CGL) (07/03/85)

In article <718@mcvax.UUCP> aeb@mcvax.UUCP (Andries Brouwer) writes:
>In article <553@ucsfcgl.UUCP> arnold@ucsfcgl.UUCP () writes:
>>The following is a minor fix to hack.  I finally got tired of having
>>multiple groups of the same kind of food, which makes keeping track
>>of things difficult.  The problem was that certain fields were not getting
>>initialized, so the "spe" field, especially, was different for different
>>pieces of food, even though the field isn't used for food.
>I see no harm in this fix, but no advantage either. Just before
>the lines quoted in the context diff is the line (mkobj.c line 55 in V1.0.2)
>	*otmp = zeroobj;
>that initializes all fields to zero; so the behaviour with and without
>the fix will be completely identical.

Well, slap ME with a wet herring!  I basically installed my fix, and
then things seemed to work better, so I posted it.  Andries is quite
right, it seems, that my fix is no fix at all.  Sigh.  Sorry about that.
If anyone DOES figure out why this proble occurs, I, for one, would
appreciate a real fix.

		Ken Arnold