Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!news.rwth-aachen.de!news-kar1.dfn.de!news-stu1.dfn.de!news-mue1.dfn.de!news-nue1.dfn.de!uni-erlangen.de!lrz-muenchen.de!informatik.tu-muenchen.de!main.Germany.EU.net!EU.net!howland.erols.net!netcom.com!erkyrath
From: erkyrath@netcom.com (Andrew Plotkin)
Subject: Re: [Inform] found_in bug?
Message-ID: <erkyrathE1M6J5.BG1@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <32990308@beachyhd.demon.co.uk> <erkyrathE1ErAr.MGA@netcom.com> <E1MLrD.6Jw%h729ihqu@sun1.cip.fak14.uni-muenchen.de>
Date: Fri, 29 Nov 1996 04:16:17 GMT
Lines: 64
Sender: erkyrath@netcom5.netcom.com

Florian Beck (fb%h729ihqu@sun1.cip.fak14.uni-muenchen.de) wrote:
> : No floating lights in Inform. :-(

> : If you want to make this work, you could try to fix the library. This 
> : prospect frightens me. Movement is an old and convoluted part of the 
> : library; ditto for floating objects.

> Hm, I thought "Hey, just replace one function, that's all!"

> Well, it's not so easy :-)

> What I found is this (in GoSub):

>   if (movewith==0) move player to j; else move movewith to j;
>   (*)
>   df=OffersLight(j);
>   if (df~=0) { location=j; lightflag=1; }
>   else
>   {   if (location==thedark) DarkToDark();
>       real_location=j;
>       location=thedark; lightflag=0;
>   }

> At first I tried to put in "MoveFloatingObjects();" in (*).
> Of course, this doesn't work.

> The floating objects are moved to "location". That's after (*).
> And if the destination has no light then "location" is the 
> "DarkRoom". No point moving floating objects there.

> OTOH, that's probably only part of the problem as the player can end
> up in a room in numerous ways.

> But am I on the right track at all?                                

I *told* you that I was frightened by library-hacking at this level.

I don't think this is going to work. The library always checks 
OffersLight() before it changes the location variable (because if there 
is no light, location will be thedark.) And MoveFloatingObjects() can 
only be called *after* location is set, because it compares the found_in 
properties of objects against location. So floating objects will never 
float in in time to light up a room. QED. :-)

Now, there are a few approaches to getting around this "proof". You could 
change MoveFloatingObjects(), and have it check the player's actual 
location (parent(player)) instead of the location variable. Or you could 
delay the OfferLight() check; *always* set location to the actual 
location, even if it's dark, call MoveFloatingObjects(), and then set 
location to thedark if OffersLight() comes up false.

Both of these are likely to have bad consequences elsewhere in the 
library. You'll have to make some other change elsewhere, which will 
require another change, and pretty soon the whole thing will be in little 
greasy piles around your garage, and when you try to put it together 
again you'll find several lag-bolts and a llama that you can't fit back 
into place.

--Z

-- 

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."
