the-infocom-files/trinity

Pouring a container doesn't work as intended

Opened this issue · 0 comments

>LOOK IN CAGE
You see a paper bag, a small coin and a credit card in the birdcage.

>FIND CAGE
You're holding it.

>FIND PAPER BAG
It's in the birdcage.

>POUR CAGE
The paper bag: It lands at your feet.

>FIND CAGE
It's right here in front of you.

>FIND BAG
It's in the birdcage.

So, in conclusion:

  • It only moved one of the objects.
  • It moved the container, not the object inside it.

It gets handled by this part of V-POUR:

	       (<IS? ,PRSO ,CONTAINER>
		<COND (<IS? ,PRSO ,OPENED>
		       <EMPTY-PRSO ,GROUND>
		       <RTRUE>)>
		<ITS-CLOSED>
		<RTRUE>)

As noted in #13 the EMPTY-PRSO routine is buggy in that it moves at most one object (because it never initializes the NXT variable).

That the cage is moved, rather than the bag, seems to be because EMPTY-PRSO calls <LANDS-AT-YOUR-FEET>, which defaults to moving PRSO. It should probably call <LANDS-AT-YOUR-FEET .OBJ> instead. Note that this only affects the case where the destination is the GROUND or the FLOOR.

So something like this seems to work:

diff --git a/verbs.zil b/verbs.zil
index 5a43393..dcf2661 100644
--- a/verbs.zil
+++ b/verbs.zil
@@ -2089,6 +2089,7 @@
                <RTRUE>)>
         <SETG P-MULT? T>
         <REPEAT ()
+                <SET NXT <NEXT? .OBJ>>
                 <COND (<NOT <IS? .OBJ ,NOARTICLE>>
                        <TELL "The ">)>
                 <TELL D .OBJ ": ">
@@ -2101,7 +2102,7 @@
                               <TELL "They ">)
                              (T
                               <TELL "It ">)>
-                       <LANDS-AT-YOUR-FEET>)
+                       <LANDS-AT-YOUR-FEET .OBJ>)
                       (<G? <- <+ <WEIGHT .DEST> <WEIGHT .OBJ>>
                               <GETP .DEST ,P?SIZE>>
                            <GETP .DEST ,P?CAPACITY>>