Another use of state_change().
[open-adventure.git] / actions.c
index b079bd352f863da9e3dab42a30da543b34efa5a9..de888d4584d1f1528378324ff5b3f50f84e22d3c 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -482,13 +482,12 @@ static int discard(token_t verb, token_t obj, bool just_do_it)
             DESTROY(BIRD);
             return GO_CLEAROBJ;
         } else if (obj == BEAR && AT(TROLL)) {
-            rspeak(TROLL_SCAMPERS);
+            state_change(TROLL, TROLL_GONE);
             move(TROLL, LOC_NOWHERE);
             move(TROLL + NOBJECTS, LOC_NOWHERE);
             move(TROLL2, objects[TROLL].plac);
             move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
             juggle(CHASM);
-            game.prop[TROLL] = TROLL_GONE;
         } else if (obj != VASE ||
                    game.loc == objects[PILLOW].plac) {
             rspeak(OK_MAN);
@@ -943,15 +942,15 @@ static int pour(token_t verb, token_t obj)
         return GO_CLEAROBJ;
     }
     if (!AT(DOOR)) {
-        if (obj != WATER) {
+        if (obj == WATER) {
+           /* cycle through the three plant states */
+           state_change(PLANT, MOD(game.prop[PLANT] + 1, 3));
+           game.prop[PLANT2] = game.prop[PLANT];
+           return GO_MOVE;
+        } else {
             rspeak(SHAKING_LEAVES);
             return GO_CLEAROBJ;
-        }
-        /* FIXME: Arithmetic on state numbers */
-        pspeak(PLANT, look, game.prop[PLANT] + 3, true);
-        game.prop[PLANT] = MOD(game.prop[PLANT] + 1, 3);
-        game.prop[PLANT2] = game.prop[PLANT];
-        return GO_MOVE;
+       }
     } else {
         state_change(DOOR, (obj == OIL) ?
                      DOOR_UNRUSTED :