Article View: net.games.hack
Article #1247Re: changing weight of gems
From: Don Kneller%Langridge
Date: Sun, 19 Jan 1986 02:24
Date: Sun, 19 Jan 1986 02:24
87 lines
3542 bytes
3542 bytes
In article <1550@bbnccv.UUCP> ptraynor@bbnccv.UUCP (Patrick Traynor) writes:
>[Purina Line-Eater chow]
>
>Here's the scenario:
>I was polymorphing large piles of rocks into gems. I had two sizable
>piles, one of jade stones and one of worthless red glass. Each had
>about 200 or so gems.
>...
>I dropped 100 jade stones
>and tried to move onto the remaining red glass, but collapsed under
>my load! Why did my load get heavier when I dropped the stones?
>
>Any theories?
>
>--pat traynor--
>
>arpa: ptraynor@bbnccv
>uucp: ...harvard!bbnccv!ptraynor
There is a bug in the polymorph routine. The routine sets the number
of gems to be the same as the number of rocks, but does not recalculate
the weight of the pile, and the weight is left at 1. When you drop *some*
of the pile, the weight is recalculated, and suddenly you can't carry
the remaining gems. Your pack load went from 1 jade stone to 100 jade
stones and you collapsed. If you drop the whole pile, the weight is not
recalculated, and you can pick the entire pile again.
Incidentally, there is another bug in the same routine. When you
polymorph a wand, you get a fully charged wand, even if the previous
wand had 0 charges. The following are the fixes for both of the
bugs. You may not want to put the min() function in. This prevents
the polymorphed wand from having more than a normal number of charges.
*** hack.zap.old Sat Jan 18 18:22:31 1986
--- hack.zap.c Thu Jan 16 16:42:21 1986
***************
*** 72,77
register struct obj *obj, *otmp; /* returns TRUE if sth was done */
{
register int res = TRUE;
if(obj == uball || obj == uchain)
res = FALSE;
--- 72,78 -----
register struct obj *obj, *otmp; /* returns TRUE if sth was done */
{
register int res = TRUE;
+ register struct obj *otmp2;
if(obj == uball || obj == uchain)
res = FALSE;
***************
*** 79,87
switch(otmp->otyp) {
case WAN_POLYMORPH:
/* preserve symbol and quantity, but turn rocks into gems */
! mkobj_at((obj->otyp == ROCK || obj->otyp == ENORMOUS_ROCK)
! ? GEM_SYM : obj->olet,
! obj->ox, obj->oy) -> quan = obj->quan;
delobj(obj);
break;
case WAN_STRIKING:
--- 80,95 -----
switch(otmp->otyp) {
case WAN_POLYMORPH:
/* preserve symbol and quantity, but turn rocks into gems */
! otmp2 = mkobj_at((obj->otyp == ROCK ||
! obj->otyp == ENORMOUS_ROCK) ? GEM_SYM : obj->olet,
! obj->ox, obj->oy);
! otmp2->quan = obj->quan;
!
! /* Keep special fields (number of charges, etc.) - dgk */
! otmp2->spe = min(otmp2->spe, otmp->spe);
! otmp2->cursed = otmp->cursed;
!
! otmp2->owt = weight(otmp2); /* update weight - dgk */
delobj(obj);
break;
case WAN_STRIKING:
--
Don Kneller
UUCP: ...ucbvax!ucsfcgl!kneller
ARPA: kneller@ucsf-cgl.ARPA
BITNET: kneller@ucsfcgl.BITNET
Technical Details
Message-ID:
<748@ucsfcgl.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!ucbvax!ucsfcgl!knellerReferences:
<1550@bbnccv.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site ucsfcgl.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!ucbvax!ucsfcgl!kneller From: kneller@ucsfcgl.UUCP (Don Kneller%Langridge) Newsgroups: net.games.hack Subject: Re: changing weight of gems Message-ID: <748@ucsfcgl.UUCP> Date: Sat, 18-Jan-86 21:24:45 EST Article-I.D.: ucsfcgl.748 Posted: Sat Jan 18 21:24:45 1986 Date-Received: Tue, 21-Jan-86 00:55:37 EST References: <1550@bbnccv.UUCP> Reply-To: kneller@ucsfcgl.UUCP (Don Kneller) Organization: UCSF Computer Graphics Lab Lines: 87 Summary: A bug, and the fix.