Unspk'd (v)carry. Made logic more visible.
authorNHOrus <jy6x2b32pie9@yahoo.com>
Tue, 4 Jul 2017 16:27:00 +0000 (19:27 +0300)
committerNHOrus <jy6x2b32pie9@yahoo.com>
Tue, 4 Jul 2017 16:30:22 +0000 (19:30 +0300)
And tested some of newly exposed cases.

actions.c
tests/urntest.chk
tests/urntest.log

index 07c55e07e95d28867344ec0eac4fa369bf4b681c..5689ad2c41d8862c8cf4525ae1b35d84304971e2 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -281,7 +281,6 @@ static int vcarry(token_t verb, token_t obj)
  *  take one without the other).  Liquids also special, since they depend on
  *  status of bottle.  Also various side effects, etc. */
 {
  *  take one without the other).  Liquids also special, since they depend on
  *  status of bottle.  Also various side effects, etc. */
 {
-    int spk;
     if (obj == INTRANSITIVE) {
         /*  Carry, no object given yet.  OK if only one object present. */
         if (game.atloc[game.loc] == 0 ||
     if (obj == INTRANSITIVE) {
         /*  Carry, no object given yet.  OK if only one object present. */
         if (game.atloc[game.loc] == 0 ||
@@ -295,46 +294,63 @@ static int vcarry(token_t verb, token_t obj)
         rspeak(ALREADY_CARRYING);
         return GO_CLEAROBJ;
     }
         rspeak(ALREADY_CARRYING);
         return GO_CLEAROBJ;
     }
-    spk = YOU_JOKING;
-    if (obj == PLANT && game.prop[PLANT] <= 0)
-        spk = DEEP_ROOTS;
-    if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR)
-        spk = BEAR_CHAINED;
-    if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR)
-        spk = STILL_LOCKED;
-    if (obj == URN)
-        spk = URN_NOBUDGE;
-    if (obj == CAVITY)
-        spk = DOUGHNUT_HOLES;
-    if (obj == BLOOD)
-        spk = FEW_DROPS;
-    if (obj == RUG && game.prop[RUG] == RUG_HOVER)
-        spk = RUG_HOVERS;
-    if (obj == SIGN)
-        spk = HAND_PASSTHROUGH;
+
     if (obj == MESSAG) {
         rspeak(REMOVE_MESSAGE);
         DESTROY(MESSAG);
         return GO_CLEAROBJ;
     }
     if (obj == MESSAG) {
         rspeak(REMOVE_MESSAGE);
         DESTROY(MESSAG);
         return GO_CLEAROBJ;
     }
+
     if (game.fixed[obj] != 0) {
     if (game.fixed[obj] != 0) {
-        rspeak(spk);
+        if (obj == PLANT && game.prop[PLANT] <= 0) {
+            rspeak(DEEP_ROOTS);
+            return GO_CLEAROBJ;
+        }
+        if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR) {
+            rspeak(BEAR_CHAINED);
+            return GO_CLEAROBJ;
+        }
+        if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR) {
+            rspeak(STILL_LOCKED);
+            return GO_CLEAROBJ;
+        }
+        if (obj == URN) {
+            rspeak(URN_NOBUDGE);
+            return GO_CLEAROBJ;
+        }
+        if (obj == CAVITY) {
+            rspeak(DOUGHNUT_HOLES);
+            return GO_CLEAROBJ;
+        }
+        if (obj == BLOOD) {
+            rspeak(FEW_DROPS);
+            return GO_CLEAROBJ;
+        }
+        if (obj == RUG && game.prop[RUG] == RUG_HOVER) {
+            rspeak(RUG_HOVERS);
+            return GO_CLEAROBJ;
+        }
+        if (obj == SIGN) {
+            rspeak(HAND_PASSTHROUGH);
+            return GO_CLEAROBJ;
+        }
+        rspeak(YOU_JOKING);
         return GO_CLEAROBJ;
     }
         return GO_CLEAROBJ;
     }
+    int spk;
     if (obj == WATER ||
         obj == OIL) {
         if (!HERE(BOTTLE) ||
             LIQUID() != obj) {
     if (obj == WATER ||
         obj == OIL) {
         if (!HERE(BOTTLE) ||
             LIQUID() != obj) {
-            if (TOTING(BOTTLE) && game.prop[BOTTLE] == EMPTY_BOTTLE)
-                return (fill(verb, BOTTLE));
-            else {
-                if (game.prop[BOTTLE] != EMPTY_BOTTLE)
-                    spk = BOTTLE_FULL;
-                if (!TOTING(BOTTLE))
-                    spk = NO_CONTAINER;
-                rspeak(spk);
+            if (TOTING(BOTTLE)) {
+                if (game.prop[BOTTLE] == EMPTY_BOTTLE) {
+                    return (fill(verb, BOTTLE));
+                } else if (game.prop[BOTTLE] != EMPTY_BOTTLE)
+                    rspeak(BOTTLE_FULL);
                 return GO_CLEAROBJ;
             }
                 return GO_CLEAROBJ;
             }
+            rspeak(NO_CONTAINER);
+            return GO_CLEAROBJ;
         }
         obj = BOTTLE;
     }
         }
         obj = BOTTLE;
     }
@@ -367,10 +383,11 @@ static int vcarry(token_t verb, token_t obj)
          -1 - game.prop[BIRD] == 1))
         carry(BIRD + CAGE - obj, game.loc);
     carry(obj, game.loc);
          -1 - game.prop[BIRD] == 1))
         carry(BIRD + CAGE - obj, game.loc);
     carry(obj, game.loc);
-    if (obj == BOTTLE && LIQUID() != 0)
+    if (obj == BOTTLE && LIQUID() != NO_OBJECT)
         game.place[LIQUID()] = CARRIED;
     if (GSTONE(obj) && game.prop[obj] != 0) {
         game.place[LIQUID()] = CARRIED;
     if (GSTONE(obj) && game.prop[obj] != 0) {
-        game.prop[obj] = STATE_GROUND;
+        game.prop[obj]
+            = STATE_GROUND;
         game.prop[CAVITY] = CAVITY_EMPTY;
     }
     rspeak(OK_MAN);
         game.prop[CAVITY] = CAVITY_EMPTY;
     }
     rspeak(OK_MAN);
index 9efe234bd40f788bae9257f22852ad5002f2b481..9caa54e4939a14d9ad226d9d9856205e68660d98 100644 (file)
@@ -1090,6 +1090,42 @@ You're at west end of Twopit Room.
 
 There is a huge beanstalk growing out of the west pit up to the hole.
 
 
 There is a huge beanstalk growing out of the west pit up to the hole.
 
+> w
+
+You're in Slab Room.
+
+> u
+
+You are in a secret n/s canyon above a large room.
+
+> reservoir
+
+You're at reservoir.
+
+The waters have parted to form a narrow path across the reservoir.
+
+> take water
+
+Your bottle is now full of water.
+
+> s
+
+You're in Mirror Canyon.
+
+> s
+
+You are in a secret n/s canyon above a large room.
+
+> d
+
+You're in Slab Room.
+
+> s
+
+You're at west end of Twopit Room.
+
+There is a huge beanstalk growing out of the west pit up to the hole.
+
 > drop appendage
 
 OK
 > drop appendage
 
 OK
@@ -1113,6 +1149,14 @@ a small pool of oil in one corner of the pit.
 
 Don't be ridiculous!
 
 
 Don't be ridiculous!
 
+> get
+
+Get what?
+
+> drink water
+
+The bottle of water is now empty.
+
 > get oil
 
 Your bottle is now full of oil.
 > get oil
 
 Your bottle is now full of oil.
@@ -1125,7 +1169,8 @@ There is a huge beanstalk growing out of the west pit up to the hole.
 
 > w
 
 
 > w
 
-You're at west end of Twopit Room.
+You are at the west end of the Twopit Room.  There is a large hole in
+the wall above the pit at this end of the room.
 
 Your keen eye spots a severed leporine appendage lying on the ground.
 
 
 Your keen eye spots a severed leporine appendage lying on the ground.
 
@@ -1281,24 +1326,10 @@ OK
 
 > se
 
 
 > se
 
-There is a threatening little dwarf in the room with you!
-
 You are in a room whose walls resemble swiss cheese.  Obvious passages
 go west, east, ne, and nw.  Part of the room is occupied by a large
 bedrock block.
 
 You are in a room whose walls resemble swiss cheese.  Obvious passages
 go west, east, ne, and nw.  Part of the room is occupied by a large
 bedrock block.
 
-> throw axe
-
-You killed a little dwarf.
-
-You're in Swiss Cheese Room.
-
-There is a little axe here.
-
-> take axe
-
-OK
-
 > e
 
 You are in the Soft Room.  The walls are covered with heavy curtains,
 > e
 
 You are in the Soft Room.  The walls are covered with heavy curtains,
@@ -1432,16 +1463,12 @@ OK
 
 It is now pitch dark.  If you proceed you will likely fall into a pit.
 
 
 It is now pitch dark.  If you proceed you will likely fall into a pit.
 
-A hollow voice says "PLUGH".
-
 > on
 
 Your lamp is now on.
 
 You're at "Y2".
 
 > on
 
 Your lamp is now on.
 
 You're at "Y2".
 
-A hollow voice says "PLUGH".
-
 > s
 
 You're in n/s passage above e/w passage.
 > s
 
 You're in n/s passage above e/w passage.
@@ -1510,8 +1537,7 @@ There is a huge beanstalk growing out of the west pit up to the hole.
 
 > w
 
 
 > w
 
-You are at the west end of the Twopit Room.  There is a large hole in
-the wall above the pit at this end of the room.
+You're at west end of Twopit Room.
 
 Your keen eye spots a severed leporine appendage lying on the ground.
 
 
 Your keen eye spots a severed leporine appendage lying on the ground.
 
@@ -1767,9 +1793,7 @@ There is a huge beanstalk growing out of the west pit up to the hole.
 
 > e
 
 
 > e
 
-You are in a room whose walls resemble swiss cheese.  Obvious passages
-go west, east, ne, and nw.  Part of the room is occupied by a large
-bedrock block.
+You're in Swiss Cheese Room.
 
 There is a little axe here.
 
 
 There is a little axe here.
 
@@ -1851,7 +1875,11 @@ There is a huge beanstalk growing out of the west pit up to the hole.
 
 > w
 
 
 > w
 
-You're in Slab Room.
+You are in a large low circular chamber whose floor is an immense slab
+fallen from the ceiling (Slab Room).  East and west there once were
+large passages, but they are now filled with boulders.  Low small
+passages go north and south, and the south one quickly bends west
+around the boulders.
 
 > u
 
 
 > u
 
@@ -1879,8 +1907,6 @@ You're in n/s passage above e/w passage.
 
 You're at "Y2".
 
 
 You're at "Y2".
 
-A hollow voice says "PLUGH".
-
 > off
 
 Your lamp is now off.
 > off
 
 Your lamp is now off.
@@ -2029,6 +2055,9 @@ Extinguish what?
 
 > look
 
 
 > look
 
+Tsk!  A wizard wouldn't have to take 350 turns.  This is going to cost
+you a couple of points.
+
 Sorry, but I am not allowed to give more detail.  I will repeat the
 long description of your location.
 
 Sorry, but I am not allowed to give more detail.  I will repeat the
 long description of your location.
 
@@ -2076,8 +2105,8 @@ If you mean to use the persian rug, it does not appear inclined to
 cooperate.
 
 
 cooperate.
 
 
-You scored 267 out of a possible 430, using 350 turns.
+You scored 265 out of a possible 430, using 358 turns.
 
 You have reached "Junior Master" status.
 
 
 You have reached "Junior Master" status.
 
-To achieve the next higher rating, you need 54 more points.
+To achieve the next higher rating, you need 56 more points.
index fa82b01a2827ba110064a126f4deae52391ba8d0..8add0dfc84e57e798931049491ee64f1a129c7e1 100644 (file)
@@ -180,10 +180,20 @@ s
 d
 water plant
 u
 d
 water plant
 u
+w
+u
+reservoir
+take water
+s
+s
+d
+s
 drop appendage
 e
 d
 drink oil
 drop appendage
 e
 d
 drink oil
+get
+drink water
 get oil
 u
 w
 get oil
 u
 w
@@ -215,8 +225,6 @@ nw
 s
 take vase
 se
 s
 take vase
 se
-throw axe
-take axe
 e
 take pillow
 w
 e
 take pillow
 w