Adapt bottle object to use state_change().
authorEric S. Raymond <esr@thyrsus.com>
Wed, 5 Jul 2017 05:15:40 +0000 (01:15 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 5 Jul 2017 05:15:40 +0000 (01:15 -0400)
actions.c
adventure.yaml

index d5d6446e4c415324951a9cdc62ad22810bc03a75..4135fba95f623a3370cee7d60cdc6b04a572bfca 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -546,9 +546,8 @@ static int drink(token_t verb, token_t obj)
         return GO_CLEAROBJ;
     }
     if (LIQUID() == WATER && HERE(BOTTLE)) {
         return GO_CLEAROBJ;
     }
     if (LIQUID() == WATER && HERE(BOTTLE)) {
-        game.prop[BOTTLE] = EMPTY_BOTTLE;
         game.place[WATER] = LOC_NOWHERE;
         game.place[WATER] = LOC_NOWHERE;
-        rspeak(BOTTLE_EMPTY);
+        state_change(BOTTLE, EMPTY_BOTTLE);
         return GO_CLEAROBJ;
     }
 
         return GO_CLEAROBJ;
     }
 
@@ -741,13 +740,11 @@ int fill(token_t verb, token_t obj)
         return GO_CLEAROBJ;
     }
 
         return GO_CLEAROBJ;
     }
 
-    game.prop[BOTTLE] = (LIQLOC(game.loc) == OIL) ? OIL_BOTTLE : WATER_BOTTLE;
+    state_change(BOTTLE, (LIQLOC(game.loc) == OIL)
+                ? OIL_BOTTLE
+                : WATER_BOTTLE);
     if (TOTING(BOTTLE))
         game.place[LIQUID()] = CARRIED;
     if (TOTING(BOTTLE))
         game.place[LIQUID()] = CARRIED;
-    if (LIQUID() == OIL)
-        rspeak(BOTTLED_OIL);
-    else
-        rspeak(BOTTLED_WATER);
     return GO_CLEAROBJ;
 }
 
     return GO_CLEAROBJ;
 }
 
index e61a2d3f9f3c4dc9d443dbabe0922ca240a74021..4338eb33fb20742bfc0899357fe8ef8ee7d9d4b7 100644 (file)
@@ -2845,7 +2845,6 @@ arbitrary_messages:  !!omap
 - STREAM_WATER: |-
     You have taken a drink from the stream.  The water tastes strongly of
     minerals, but is not unpleasant.  It is extremely cold.
 - STREAM_WATER: |-
     You have taken a drink from the stream.  The water tastes strongly of
     minerals, but is not unpleasant.  It is extremely cold.
-- BOTTLE_EMPTY: 'The bottle of water is now empty.'
 - RUB_NOGO: |-
     Rubbing the electric lamp is not particularly rewarding.  Anyway,
     nothing exciting happens.
 - RUB_NOGO: |-
     Rubbing the electric lamp is not particularly rewarding.  Anyway,
     nothing exciting happens.
@@ -2871,8 +2870,6 @@ arbitrary_messages:  !!omap
 - NO_CONTAINER: 'You have nothing in which to carry it.'
 - BOTTLE_FULL: 'Your bottle is already full.'
 - NO_LIQUID: 'There is nothing here with which to fill the bottle.'
 - NO_CONTAINER: 'You have nothing in which to carry it.'
 - BOTTLE_FULL: 'Your bottle is already full.'
 - NO_LIQUID: 'There is nothing here with which to fill the bottle.'
-- BOTTLED_WATER: 'Your bottle is now full of water.'
-- BOTTLED_OIL: 'Your bottle is now full of oil.'
 - CANT_FILL: 'You can''t fill that.'
 - RIDICULOUS_ATTEMPT: 'Don''t be ridiculous!'
 - RUSTY_DOOR: 'The door is extremely rusty and refuses to open.'
 - CANT_FILL: 'You can''t fill that.'
 - RIDICULOUS_ATTEMPT: 'Don''t be ridiculous!'
 - RUSTY_DOOR: 'The door is extremely rusty and refuses to open.'
@@ -3387,6 +3384,10 @@ objects: !!omap
     - 'There is a bottle of water here.'
     - 'There is an empty bottle here.'
     - 'There is a bottle of oil here.'
     - 'There is a bottle of water here.'
     - 'There is an empty bottle here.'
     - 'There is a bottle of oil here.'
+    changes:
+    - 'Your bottle is now full of water.'
+    - 'The bottle of water is now empty.'
+    - 'Your bottle is now full of oil.'
 - WATER:
     words: ['water', 'h2o']
     inventory: 'Water in the bottle'
 - WATER:
     words: ['water', 'h2o']
     inventory: 'Water in the bottle'