🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.games.hack
Article #19

Bug when polymorphing rocks

#19
From: Mike Schloss
Date: Mon, 23 Dec 1985 18:20
54 lines
2332 bytes
Greetings fellow hackers.  I have a question for you.
I think there is a problem with the code dealing with
polymorphing rocks into gems.  The code fragment follows.

	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;
	.
	.
	.
	}

What happens is that is turned into a pile of gems with the weight
of one gem.  If you then change the number of items in the pile in
any way (say by adding more or dropping some but not all) the weight
will then be correctly calculated.  This could result in you not being
able to carry what you've already got in your knapsack.  The fix is as
follows:

	register struct	obj	*otmp2;

	.
	.
	.

	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;
		otmp2->owt = obj->owt;
		delobj(obj);
		break;
	.
	.
	.
	}

I know this prevents people from collecting millions of Zorkmids worth
of gems but should one be able to do this.  They should weigh something.
It seems though that a gem that weighs the same amount as a rock suitable
as a weapon (without a sling) should be worth alot.  When polymorphing a
rock into a gem does it's size change.  If you polymorph a dragon corpse
into a tripe ration I would expect it's size to change.  Similarly with
other monsters.  Any comments... How about you A.B.

							Mike
Technical Details
Message-ID: <517@enmasse.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!ucbvax!ucdavis!lll-crg!seismo!harvard!talcott!panda!enmasse!mike

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/3/84; site enmasse.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!ucbvax!ucdavis!lll-crg!seismo!harvard!talcott!panda!enmasse!mike
From: mike@enmasse.UUCP (Mike Schloss)
Newsgroups: net.games.hack
Subject: Bug when polymorphing rocks
Message-ID: <517@enmasse.UUCP>
Date: Mon, 23-Dec-85 13:20:41 EST
Article-I.D.: enmasse.517
Posted: Mon Dec 23 13:20:41 1985
Date-Received: Wed, 25-Dec-85 03:43:52 EST
Distribution: net
Organization: Enmasse Computer Corp., Acton, Mass.
Lines: 54