the-infocom-files / hitchhiker

The Hitchhiker’s Guide to the Galaxy
20 stars 4 forks source link

Bedroom door bugs (one of which causes a Frotz warning) #29

Open eriktorbjorn opened 4 years ago

eriktorbjorn commented 4 years ago
>LOOK
Bedroom
The bedroom is a mess.
It is a small bedroom with a faded carpet and old wallpaper. There is a
washbasin, a chair with a tatty dressing gown slung over it, and a window with
the curtains drawn. Near the exit leading south is a phone.
There is a toothbrush here.
There is a flathead screwdriver here.

>GO THROUGH DOOR
Warning: @jin called with object 0 (PC = cba2) (will ignore further occurrences)
Did you have any particular direction in mind?

I think what happens here is that V-THROUGH sees that BEDROOM-DOOR has DOORBIT, and calls <DO-WALK <OTHER-SIDE ,PRSO>>. But OTHER-SIDE only finds door exits, but the exits from the bedroom are all function exits.

I haven't tried to trace the execution, but I'm guessing V-WALK gets to the case where it redirects it to a WALK-TO action, and that PRSO is 0 at this point. Because PC cba2 seems to be at the start of V-WALK-TO where it checks if PRSO is in the room.

Long story short, BEDROOM-DOOR needs its own handling of the THROUGH action.

I haven't tested this, but something like this I imagine:

(<VERB? THROUGH>
 <COND (<EQUAL? ,HERE ,BEDROOM>
        <DO-WALK ,P?SOUTH>)
       (T
        <DO-WALK ,P?NORTH>)>)

It's possible that we only need to handle the bedroom case, but it turns out that the front porch exit isn't a door exit either. Even though it really should be, because it turns out that we can do this:

>SOUTH
You make your way down to the front porch.

Front Porch
This is the enclosed front porch of your home. Your front garden lies to the
south, and you can re-enter your home to the north.
On the doormat is a pile of junk mail.

>CLOSE DOOR
Okay, the door is now closed.

>NORTH
Bedroom
The bedroom is a mess.
It is a small bedroom with a faded carpet and old wallpaper. There is a
washbasin, a chair, and a window with the curtains drawn. Near the exit leading
south is a phone.

>SOUTH
The door is closed.