the-infocom-files / zork2

Zork II: The Wizard of Frobozz
8 stars 4 forks source link

Putting multiple objects in the balloon receptacle is handled inconsistently #46

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

You're only supposed to be able to put one object at a time in the balloon receptacle. But that's not enforced as well as it should:

When inside the basket:

>PUT NEWSPAPER IN RECEPTACLE
Done.

>PUT STRING IN RECEPTACLE
The receptacle is already occupied.

When outside the basket:

>PUT NEWSPAPER IN RECEPTACLE
Done.

>PUT STRING IN RECEPTACLE
Done.

The "already occupied" message is apparently printed by BALLOON-FCN when RARG is M-BEG. As far as I can tell, the M-BEG parameter is only used when invoking the action routine in <LOC ,WINNER>, so I guess that's why it only happens when you're inside.

eriktorbjorn commented 5 years ago

I think the correct solution is to move the check to the receptacle's action routine. It currently uses BCONTENTS, but we could change it to RECEPTACLE-FCN and define it as:

<ROUTINE RECEPTACLE-FCN ()
     <COND (<AND <VERB? PUT>
                 <FIRST? ,RECEPTACLE>>
            <TELL "The receptacle is already occupied." CR>)
           (T
        <BCONTENTS>)>>

And then, of course, remove that check from BALLOON-FCN.

eriktorbjorn commented 5 years ago

I missed that BALLOON-FCN does two things when putting objects in the receptacle:

              (<AND <VERB? PUT>
                <EQUAL? ,PRSI ,RECEPTACLE>
                <FIRST? ,RECEPTACLE>>
               <TELL "The receptacle is already occupied." CR>
               <RTRUE>)
              (<AND <VERB? PUT>
                <EQUAL? ,PRSI ,RECEPTACLE>>
               <FSET ,PRSO ,NDESCBIT>
               <RFALSE>)

So RECEPTACLE-FCN would have to handle both. Though setting NDESCBIT actually leads to another glitch, which I'll report separately.