Grammar fix.
[open-adventure.git] / actions.c
1 #include <stdlib.h>
2 #include <stdbool.h>
3 #include <string.h>
4 #include "advent.h"
5 #include "dungeon.h"
6
7 static int fill(token_t, token_t);
8
9 static void state_change(long obj, long state)
10 {
11     game.prop[obj] = state;
12     pspeak(obj, change, state, true);
13 }
14
15 static int attack(struct command_t *command)
16 /*  Attack.  Assume target if unambiguous.  "Throw" also links here.
17  *  Attackable objects fall into two categories: enemies (snake,
18  *  dwarf, etc.)  and others (bird, clam, machine).  Ambiguous if 2
19  *  enemies, or no enemies but 2 others. */
20 {
21     vocab_t verb = command->verb;
22     vocab_t obj = command->obj;
23
24     long spk = actions[verb].message;
25     if (obj == NO_OBJECT ||
26         obj == INTRANSITIVE) {
27         int changes = 0;
28         if (atdwrf(game.loc) > 0) {
29             obj = DWARF;
30             ++changes;
31         }
32         if (HERE(SNAKE)) {
33             obj = SNAKE;
34             ++changes;
35         }
36         if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS) {
37             obj = DRAGON;
38             ++changes;
39         }
40         if (AT(TROLL)) {
41             obj = TROLL;
42             ++changes;
43         }
44         if (AT(OGRE)) {
45             obj = OGRE;
46             ++changes;
47         }
48         if (HERE(BEAR) && game.prop[BEAR] == UNTAMED_BEAR) {
49             obj = BEAR;
50             ++changes;
51         }
52         /* check for low-priority targets */
53         if (obj == NO_OBJECT) {
54             /* Can't attack bird or machine by throwing axe. */
55             if (HERE(BIRD) && verb != THROW) {
56                 obj = BIRD;
57                 ++changes;
58             }
59             if (HERE(VEND) && verb != THROW) {
60                 obj = VEND;
61                 ++changes;
62             }
63             /* Clam and oyster both treated as clam for intransitive case;
64              * no harm done. */
65             if (HERE(CLAM) || HERE(OYSTER)) {
66                 obj = CLAM;
67                 ++changes;
68             }
69         }
70         if (changes >= 2)
71             return GO_UNKNOWN;
72
73     }
74     if (obj == BIRD) {
75         if (game.closed) {
76             rspeak(UNHAPPY_BIRD);
77             return GO_CLEAROBJ;
78         }
79         DESTROY(BIRD);
80         spk = BIRD_DEAD;
81     } else if (obj == VEND) {
82         state_change(VEND,
83                      game.prop[VEND] == VEND_BLOCKS ? VEND_UNBLOCKS : VEND_BLOCKS);
84         return GO_CLEAROBJ;
85     }
86
87     if (obj == NO_OBJECT)
88         spk = NO_TARGET;
89     if (obj == CLAM ||
90         obj == OYSTER)
91         spk = SHELL_IMPERVIOUS;
92     if (obj == SNAKE)
93         spk = SNAKE_WARNING;
94     if (obj == DWARF)
95         spk = BARE_HANDS_QUERY;
96     if (obj == DWARF && game.closed)
97         return GO_DWARFWAKE;
98     if (obj == DRAGON)
99         spk = ALREADY_DEAD;
100     if (obj == TROLL)
101         spk = ROCKY_TROLL;
102     if (obj == OGRE)
103         spk = OGRE_DODGE;
104     if (obj == OGRE && atdwrf(game.loc) > 0) {
105         rspeak(spk);
106         rspeak(KNIFE_THROWN);
107         DESTROY(OGRE);
108         int dwarves = 0;
109         for (int i = 1; i < PIRATE; i++) {
110             if (game.dloc[i] == game.loc) {
111                 ++dwarves;
112                 game.dloc[i] = LOC_LONGWEST;
113                 game.dseen[i] = false;
114             }
115         }
116         spk = (dwarves > 1) ?
117               OGRE_PANIC1 :
118               OGRE_PANIC2;
119     } else if (obj == BEAR) {
120         switch (game.prop[BEAR]) {
121         case UNTAMED_BEAR:
122             spk = BEAR_HANDS;
123             break;
124         case SITTING_BEAR:
125             spk = BEAR_CONFUSED;
126             break;
127         case CONTENTED_BEAR:
128             spk = BEAR_CONFUSED;
129             break;
130         case BEAR_DEAD:
131             spk = ALREADY_DEAD;
132             break;
133         }
134     } else if (obj == DRAGON && game.prop[DRAGON] == DRAGON_BARS) {
135         /*  Fun stuff for dragon.  If he insists on attacking it, win!
136          *  Set game.prop to dead, move dragon to central loc (still
137          *  fixed), move rug there (not fixed), and move him there,
138          *  too.  Then do a null motion to get new description. */
139         rspeak(BARE_HANDS_QUERY);
140         if (silent_yes()) {
141             // FIXME: setting wd1 is a workaround for broken logic
142             command->wd1 = token_to_packed("Y");
143         } else {
144             // FIXME: setting wd1 is a workaround for broken logic
145             command->wd1 = token_to_packed("N");
146             return GO_CHECKFOO;
147         }
148         state_change(DRAGON, DRAGON_DEAD);
149         game.prop[RUG] = RUG_FLOOR;
150         /* FIXME: Arithmetic on location values */
151         int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
152         move(DRAGON + NOBJECTS, -1);
153         move(RUG + NOBJECTS, 0);
154         move(DRAGON, k);
155         move(RUG, k);
156         drop(BLOOD, k);
157         for (obj = 1; obj <= NOBJECTS; obj++) {
158             if (game.place[obj] == objects[DRAGON].plac ||
159                 game.place[obj] == objects[DRAGON].fixd)
160                 move(obj, k);
161         }
162         game.loc = k;
163         return GO_MOVE;
164     }
165
166     rspeak(spk);
167     return GO_CLEAROBJ;
168 }
169
170 static int bigwords(token_t foo)
171 /*  FEE FIE FOE FOO (AND FUM).  Advance to next state if given in proper order.
172  *  Look up foo in special section of vocab to determine which word we've got.
173  *  Last word zips the eggs back to the giant room (unless already there). */
174 {
175     char word[TOKLEN + 1];
176     packed_to_token(foo, word);
177     int k = (int) get_special_vocab_id(word);
178     if (game.foobar != 1 - k) {
179         if (game.foobar != 0 && game.loc == LOC_GIANTROOM) {
180             rspeak( START_OVER);
181         } else {
182             rspeak(NOTHING_HAPPENS);
183         }
184         return GO_CLEAROBJ;
185     } else {
186         game.foobar = k;
187         if (k != 4) {
188             rspeak(OK_MAN);
189             return GO_CLEAROBJ;
190         }
191         game.foobar = 0;
192         if (game.place[EGGS] == objects[EGGS].plac ||
193             (TOTING(EGGS) && game.loc == objects[EGGS].plac)) {
194             rspeak(NOTHING_HAPPENS);
195             return GO_CLEAROBJ;
196         } else {
197             /*  Bring back troll if we steal the eggs back from him before
198              *  crossing. */
199             if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
200                 game.prop[TROLL] = TROLL_PAIDONCE;
201             k = EGGS_DONE;
202             if (HERE(EGGS))
203                 k = EGGS_VANISHED;
204             if (game.loc == objects[EGGS].plac)
205                 k = EGGS_HERE;
206             move(EGGS, objects[EGGS].plac);
207             pspeak(EGGS, look, k, true);
208             return GO_CLEAROBJ;
209         }
210     }
211 }
212
213 static int bivalve(token_t verb, token_t obj)
214 /* Clam/oyster actions */
215 {
216     bool is_oyster = (obj == OYSTER);
217     if (verb == LOCK) {
218         rspeak(HUH_MAN);
219         return GO_CLEAROBJ;
220     }
221     if (!TOTING(TRIDENT)) {
222         rspeak(is_oyster ?
223                OYSTER_OPENER :
224                CLAM_OPENER);
225         return GO_CLEAROBJ;
226     }
227     if (TOTING(obj)) {
228         rspeak( is_oyster ?
229                 DROP_OYSTER :
230                 DROP_CLAM);
231         return GO_CLEAROBJ;
232     }
233
234     if (!is_oyster) {
235         DESTROY(CLAM);
236         drop(OYSTER, game.loc);
237         drop(PEARL, LOC_CULDESAC);
238     }
239     rspeak(is_oyster ?
240            OYSTER_OPENS :
241            PEARL_FALLS);
242     return GO_CLEAROBJ;
243 }
244
245 static void blast(void)
246 /*  Blast.  No effect unless you've got dynamite, which is a neat trick! */
247 {
248     if (game.prop[ROD2] < 0 ||
249         !game.closed)
250         rspeak(REQUIRES_DYNAMITE);
251     else {
252         game.bonus = VICTORY_MESSAGE;
253         if (game.loc == LOC_NE)
254             game.bonus = DEFEAT_MESSAGE;
255         if (HERE(ROD2))
256             game.bonus = SPLATTER_MESSAGE;
257         rspeak(game.bonus);
258         terminate(endgame);
259     }
260 }
261
262 static int vbreak(token_t verb, token_t obj)
263 /*  Break.  Only works for mirror in repository and, of course, the vase. */
264 {
265     if (obj == MIRROR) {
266         if (game.closed) {
267             rspeak(BREAK_MIRROR);
268             return GO_DWARFWAKE;
269         } else {
270             rspeak(TOO_FAR);
271             return GO_CLEAROBJ;
272         }
273     }
274     if (obj == VASE && game.prop[VASE] == VASE_WHOLE) {
275         if (TOTING(VASE))
276             drop(VASE, game.loc);
277         state_change(VASE, VASE_BROKEN);
278         game.fixed[VASE] = -1;
279         return GO_CLEAROBJ;
280     }
281     rspeak(actions[verb].message);
282     return (GO_CLEAROBJ);
283 }
284
285 static int brief(void)
286 /*  Brief.  Intransitive only.  Suppress long descriptions after first time. */
287 {
288     game.abbnum = 10000;
289     game.detail = 3;
290     rspeak(BRIEF_CONFIRM);
291     return GO_CLEAROBJ;
292 }
293
294 static int vcarry(token_t verb, token_t obj)
295 /*  Carry an object.  Special cases for bird and cage (if bird in cage, can't
296  *  take one without the other).  Liquids also special, since they depend on
297  *  status of bottle.  Also various side effects, etc. */
298 {
299     int spk;
300     if (obj == INTRANSITIVE) {
301         /*  Carry, no object given yet.  OK if only one object present. */
302         if (game.atloc[game.loc] == 0 ||
303             game.link[game.atloc[game.loc]] != 0 ||
304             atdwrf(game.loc) > 0)
305             return GO_UNKNOWN;
306         obj = game.atloc[game.loc];
307     }
308
309     if (TOTING(obj)) {
310         rspeak(ALREADY_CARRYING);
311         return GO_CLEAROBJ;
312     }
313     spk = YOU_JOKING;
314     if (obj == PLANT && game.prop[PLANT] <= 0)
315         spk = DEEP_ROOTS;
316     if (obj == BEAR && game.prop[BEAR] == SITTING_BEAR)
317         spk = BEAR_CHAINED;
318     if (obj == CHAIN && game.prop[BEAR] != UNTAMED_BEAR)
319         spk = STILL_LOCKED;
320     if (obj == URN)
321         spk = URN_NOBUDGE;
322     if (obj == CAVITY)
323         spk = DOUGHNUT_HOLES;
324     if (obj == BLOOD)
325         spk = FEW_DROPS;
326     if (obj == RUG && game.prop[RUG] == RUG_HOVER)
327         spk = RUG_HOVERS;
328     if (obj == SIGN)
329         spk = HAND_PASSTHROUGH;
330     if (obj == MESSAG) {
331         rspeak(REMOVE_MESSAGE);
332         DESTROY(MESSAG);
333         return GO_CLEAROBJ;
334     }
335     if (game.fixed[obj] != 0) {
336         rspeak(spk);
337         return GO_CLEAROBJ;
338     }
339     if (obj == WATER ||
340         obj == OIL) {
341         if (!HERE(BOTTLE) ||
342             LIQUID() != obj) {
343             if (TOTING(BOTTLE) && game.prop[BOTTLE] == EMPTY_BOTTLE)
344                 return (fill(verb, BOTTLE));
345             else {
346                 if (game.prop[BOTTLE] != EMPTY_BOTTLE)
347                     spk = BOTTLE_FULL;
348                 if (!TOTING(BOTTLE))
349                     spk = NO_CONTAINER;
350                 rspeak(spk);
351                 return GO_CLEAROBJ;
352             }
353         }
354         obj = BOTTLE;
355     }
356
357     spk = CARRY_LIMIT;
358     if (game.holdng >= INVLIMIT) {
359         rspeak(spk);
360         return GO_CLEAROBJ;
361     } else if (obj == BIRD && game.prop[BIRD] != BIRD_CAGED && -1 - game.prop[BIRD] != BIRD_CAGED) {
362         if (game.prop[BIRD] == BIRD_FOREST_UNCAGED) {
363             DESTROY(BIRD);
364             rspeak(BIRD_CRAP);
365             return GO_CLEAROBJ;
366         }
367         if (!TOTING(CAGE))
368             spk = CANNOT_CARRY;
369         if (TOTING(ROD))
370             spk = BIRD_EVADES;
371         if (spk == CANNOT_CARRY ||
372             spk == BIRD_EVADES) {
373             rspeak(spk);
374             return GO_CLEAROBJ;
375         }
376         game.prop[BIRD] = BIRD_CAGED;
377     }
378     /* FIXME: Arithmetic on state numbers */
379     if ((obj == BIRD ||
380          obj == CAGE) &&
381         (game.prop[BIRD] == BIRD_CAGED ||
382          -1 - game.prop[BIRD] == 1))
383         carry(BIRD + CAGE - obj, game.loc);
384     carry(obj, game.loc);
385     if (obj == BOTTLE && LIQUID() != 0)
386         game.place[LIQUID()] = CARRIED;
387     if (GSTONE(obj) && game.prop[obj] != 0) {
388         game.prop[obj] = STATE_GROUND;
389         game.prop[CAVITY] = CAVITY_EMPTY;
390     }
391     rspeak(OK_MAN);
392     return GO_CLEAROBJ;
393 }
394
395 static int chain(token_t verb)
396 /* Do something to the bear's chain */
397 {
398     if (verb != LOCK) {
399         if (game.prop[BEAR] == UNTAMED_BEAR) {
400             rspeak(BEAR_BLOCKS);
401             return GO_CLEAROBJ;
402         }
403         if (game.prop[CHAIN] == CHAIN_HEAP) {
404             rspeak(ALREADY_UNLOCKED);
405             return GO_CLEAROBJ;
406         }
407         game.prop[CHAIN] = CHAIN_HEAP;
408         game.fixed[CHAIN] = CHAIN_HEAP;
409         if (game.prop[BEAR] != BEAR_DEAD)
410             game.prop[BEAR] = CONTENTED_BEAR;
411
412         switch (game.prop[BEAR]) {
413         case BEAR_DEAD:
414             game.fixed[BEAR] = -1;
415             break;
416         default:
417             game.fixed[BEAR] = 0;
418         }
419         rspeak(CHAIN_UNLOCKED);
420         return GO_CLEAROBJ;
421     }
422
423     if (game.prop[CHAIN] != CHAIN_HEAP) {
424         rspeak(ALREADY_LOCKED);
425         return GO_CLEAROBJ;
426     }
427     if (game.loc != objects[CHAIN].plac) {
428         rspeak(NO_LOCKSITE);
429         return GO_CLEAROBJ;
430     }
431
432     game.prop[CHAIN] = CHAIN_FIXED;
433
434     if (TOTING(CHAIN))
435         drop(CHAIN, game.loc);
436     game.fixed[CHAIN] = -1;
437
438     rspeak(CHAIN_LOCKED);
439     return GO_CLEAROBJ;
440 }
441
442 static int discard(token_t verb, token_t obj, bool just_do_it)
443 /*  Discard object.  "Throw" also comes here for most objects.  Special cases for
444  *  bird (might attack snake or dragon) and cage (might contain bird) and vase.
445  *  Drop coins at vending machine for extra batteries. */
446 {
447     int spk = actions[verb].message;
448     if (!just_do_it) {
449         if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))
450             obj = ROD2;
451         if (!TOTING(obj)) {
452             rspeak(spk);
453             return GO_CLEAROBJ;
454         }
455         if (obj == BIRD && HERE(SNAKE)) {
456             rspeak(BIRD_ATTACKS);
457             if (game.closed)
458                 return GO_DWARFWAKE;
459             DESTROY(SNAKE);
460             /* Set game.prop for use by travel options */
461             game.prop[SNAKE] = SNAKE_CHASED;
462
463         } else if ((GSTONE(obj) && AT(CAVITY) && game.prop[CAVITY] != CAVITY_FULL)) {
464             rspeak(GEM_FITS);
465             game.prop[obj] = 1;
466             game.prop[CAVITY] = CAVITY_FULL;
467             if (HERE(RUG) && ((obj == EMERALD && game.prop[RUG] != RUG_HOVER) ||
468                               (obj == RUBY && game.prop[RUG] == RUG_HOVER))) {
469                 spk = RUG_RISES;
470                 if (TOTING(RUG))
471                     spk = RUG_WIGGLES;
472                 if (obj == RUBY)
473                     spk = RUG_SETTLES;
474                 rspeak(spk);
475                 if (spk != RUG_WIGGLES) {
476                     /* FIXME: Arithmetic on state numbers */
477                     int k = 2 - game.prop[RUG];
478                     game.prop[RUG] = k;
479                     if (k == 2)
480                         k = objects[SAPPH].plac;
481                     move(RUG + NOBJECTS, k);
482                 }
483             }
484         } else if (obj == COINS && HERE(VEND)) {
485             DESTROY(COINS);
486             drop(BATTERY, game.loc);
487             pspeak(BATTERY, look, FRESH_BATTERIES, true);
488             return GO_CLEAROBJ;
489         } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS) {
490             rspeak(BIRD_BURNT);
491             DESTROY(BIRD);
492             return GO_CLEAROBJ;
493         } else if (obj == BEAR && AT(TROLL)) {
494             state_change(TROLL, TROLL_GONE);
495             move(TROLL, LOC_NOWHERE);
496             move(TROLL + NOBJECTS, LOC_NOWHERE);
497             move(TROLL2, objects[TROLL].plac);
498             move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
499             juggle(CHASM);
500         } else if (obj != VASE ||
501                    game.loc == objects[PILLOW].plac) {
502             rspeak(OK_MAN);
503         } else {
504             game.prop[VASE] = VASE_BROKEN;
505             if (AT(PILLOW))
506                 game.prop[VASE] = VASE_WHOLE;
507             pspeak(VASE, look, game.prop[VASE] + 1, true);
508             if (game.prop[VASE] != VASE_WHOLE)
509                 game.fixed[VASE] = -1;
510         }
511     }
512     int k = LIQUID();
513     if (k == obj)
514         obj = BOTTLE;
515     if (obj == BOTTLE && k != 0)
516         game.place[k] = LOC_NOWHERE;
517     if (obj == CAGE && game.prop[BIRD] == BIRD_CAGED)
518         drop(BIRD, game.loc);
519     drop(obj, game.loc);
520     if (obj != BIRD)
521         return GO_CLEAROBJ;
522     game.prop[BIRD] = BIRD_UNCAGED;
523     if (FOREST(game.loc))
524         game.prop[BIRD] = BIRD_FOREST_UNCAGED;
525     return GO_CLEAROBJ;
526 }
527
528 static int drink(token_t verb, token_t obj)
529 /*  Drink.  If no object, assume water and look for it here.  If water is in
530  *  the bottle, drink that, else must be at a water loc, so drink stream. */
531 {
532     if (obj == NO_OBJECT && LIQLOC(game.loc) != WATER &&
533         (LIQUID() != WATER || !HERE(BOTTLE))) {
534         return GO_UNKNOWN;
535     }
536
537     if (obj == BLOOD) {
538         DESTROY(BLOOD);
539         state_change(DRAGON, DRAGON_BLOODLESS);
540         game.blooded = true;
541         return GO_CLEAROBJ;
542     }
543
544     if (obj != NO_OBJECT && obj != WATER) {
545         rspeak(RIDICULOUS_ATTEMPT);
546         return GO_CLEAROBJ;
547     }
548     if (LIQUID() == WATER && HERE(BOTTLE)) {
549         game.prop[BOTTLE] = EMPTY_BOTTLE;
550         game.place[WATER] = LOC_NOWHERE;
551         rspeak(BOTTLE_EMPTY);
552         return GO_CLEAROBJ;
553     }
554
555     rspeak(actions[verb].message);
556     return GO_CLEAROBJ;
557 }
558
559 static int eat(token_t verb, token_t obj)
560 /*  Eat.  Intransitive: assume food if present, else ask what.  Transitive: food
561  *  ok, some things lose appetite, rest are ridiculous. */
562 {
563     if (obj == INTRANSITIVE) {
564         if (!HERE(FOOD))
565             return GO_UNKNOWN;
566         DESTROY(FOOD);
567         rspeak(THANKS_DELICIOUS);
568         return GO_CLEAROBJ;
569     }
570     if (obj == FOOD) {
571         DESTROY(FOOD);
572         rspeak(THANKS_DELICIOUS);
573         return GO_CLEAROBJ;
574     }
575     if (obj == BIRD ||
576         obj == SNAKE ||
577         obj == CLAM ||
578         obj == OYSTER ||
579         obj == DWARF ||
580         obj == DRAGON ||
581         obj == TROLL ||
582         obj == BEAR ||
583         obj == OGRE) {
584         rspeak(LOST_APPETITE);
585         return GO_CLEAROBJ;
586     }
587     rspeak(actions[verb].message);
588     return GO_CLEAROBJ;
589 }
590
591 static int extinguish(token_t verb, int obj)
592 /* Extinguish.  Lamp, urn, dragon/volcano (nice try). */
593 {
594     if (obj == INTRANSITIVE) {
595         if (HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT)
596             obj = LAMP;
597         if (HERE(URN) && game.prop[URN] == URN_LIT)
598             obj = URN;
599         if (obj == INTRANSITIVE)
600             return GO_UNKNOWN;
601     }
602
603     if (obj == URN) {
604         if (game.prop[URN] != URN_EMPTY) {
605             state_change(URN, URN_DARK);
606         } else {
607             pspeak(URN, change, URN_DARK, true);
608         }
609         return GO_CLEAROBJ;
610     }
611
612     if (obj == LAMP) {
613         state_change(LAMP, LAMP_DARK);
614         rspeak(DARK(game.loc) ?
615                PITCH_DARK :
616                NO_MESSAGE);
617         return GO_CLEAROBJ;
618     }
619
620     if (obj == DRAGON ||
621         obj == VOLCANO) {
622         rspeak(BEYOND_POWER);
623         return GO_CLEAROBJ;
624     }
625
626     rspeak(actions[verb].message);
627     return GO_CLEAROBJ;
628 }
629
630 static int feed(token_t verb, token_t obj)
631 /*  Feed.  If bird, no seed.  Snake, dragon, troll: quip.  If dwarf, make him
632  *  mad.  Bear, special. */
633 {
634     int spk = actions[verb].message;
635     if (obj == BIRD) {
636         rspeak(BIRD_PINING);
637         return GO_CLEAROBJ;
638     } else if (obj == SNAKE ||
639                obj == DRAGON ||
640                obj == TROLL) {
641         spk = NOTHING_EDIBLE;
642         if (obj == DRAGON && game.prop[DRAGON] != DRAGON_BARS)
643             spk = RIDICULOUS_ATTEMPT;
644         if (obj == TROLL)
645             spk = TROLL_VICES;
646         if (obj == SNAKE && !game.closed && HERE(BIRD)) {
647             DESTROY(BIRD);
648             spk = BIRD_DEVOURED;
649         }
650     } else if (obj == DWARF) {
651         if (HERE(FOOD)) {
652             game.dflag += 2;
653             spk = REALLY_MAD;
654         }
655     } else if (obj == BEAR) {
656         if (game.prop[BEAR] == UNTAMED_BEAR)
657             spk = NOTHING_EDIBLE;
658         if (game.prop[BEAR] == BEAR_DEAD)
659             spk = RIDICULOUS_ATTEMPT;
660         if (HERE(FOOD)) {
661             DESTROY(FOOD);
662             game.prop[BEAR] = SITTING_BEAR;
663             game.fixed[AXE] = 0;
664             game.prop[AXE] = 0;
665             spk = BEAR_TAMED;
666         }
667     } else if (obj == OGRE) {
668         if (HERE(FOOD))
669             spk = OGRE_FULL;
670     } else {
671         spk = AM_GAME;
672     }
673     rspeak(spk);
674     return GO_CLEAROBJ;
675 }
676
677 int fill(token_t verb, token_t obj)
678 /*  Fill.  Bottle or urn must be empty, and liquid available.  (Vase
679  *  is nasty.) */
680 {
681     if (obj == VASE) {
682         if (LIQLOC(game.loc) == NO_OBJECT) {
683             rspeak(FILL_INVALID);
684             return GO_CLEAROBJ;
685         }
686         if (!TOTING(VASE)) {
687             rspeak(ARENT_CARRYING);
688             return GO_CLEAROBJ;
689         }
690         rspeak(SHATTER_VASE);
691         game.prop[VASE] = VASE_BROKEN;
692         game.fixed[VASE] = -1;
693         return (discard(verb, obj, true));
694     }
695
696     if (obj == URN) {
697         if (game.prop[URN] != URN_EMPTY) {
698             rspeak(FULL_URN);
699             return GO_CLEAROBJ;
700         }
701         if (!HERE(BOTTLE)) {
702             rspeak(FILL_INVALID);
703             return GO_CLEAROBJ;
704         }
705         int k = LIQUID();
706         switch (k) {
707         case WATER:
708             game.prop[BOTTLE] = EMPTY_BOTTLE;
709             rspeak(WATER_URN);
710             break;
711         case OIL:
712             game.prop[URN] = URN_DARK;
713             game.prop[BOTTLE] = EMPTY_BOTTLE;
714             rspeak(OIL_URN);
715             break;
716         case NO_OBJECT:
717         default:
718             rspeak(FILL_INVALID);
719             return GO_CLEAROBJ;
720         }
721         game.place[k] = LOC_NOWHERE;
722         return GO_CLEAROBJ;
723     }
724     if (obj != NO_OBJECT && obj != BOTTLE) {
725         rspeak(actions[verb].message);
726         return GO_CLEAROBJ;
727     }
728     if (obj == NO_OBJECT && !HERE(BOTTLE))
729         return GO_UNKNOWN;
730
731     if (HERE(URN) && game.prop[URN] != URN_EMPTY) {
732         rspeak(URN_NOPOUR);
733         return GO_CLEAROBJ;
734     }
735     if (LIQUID() != NO_OBJECT) {
736         rspeak(BOTTLE_FULL);
737         return GO_CLEAROBJ;
738     }
739     if (LIQLOC(game.loc) == NO_OBJECT) {
740         rspeak(NO_LIQUID);
741         return GO_CLEAROBJ;
742     }
743
744     game.prop[BOTTLE] = (LIQLOC(game.loc) == OIL) ? OIL_BOTTLE : WATER_BOTTLE;
745     if (TOTING(BOTTLE))
746         game.place[LIQUID()] = CARRIED;
747     if (LIQUID() == OIL)
748         rspeak(BOTTLED_OIL);
749     else
750         rspeak(BOTTLED_WATER);
751     return GO_CLEAROBJ;
752 }
753
754 static int find(token_t verb, token_t obj)
755 /* Find.  Might be carrying it, or it might be here.  Else give caveat. */
756 {
757     if (TOTING(obj)) {
758         rspeak(ALREADY_CARRYING);
759         return GO_CLEAROBJ;
760     }
761
762     if (game.closed) {
763         rspeak(NEEDED_NEARBY);
764         return GO_CLEAROBJ;
765     }
766
767     if (AT(obj) ||
768         (LIQUID() == obj && AT(BOTTLE)) ||
769         obj == LIQLOC(game.loc) ||
770         (obj == DWARF && atdwrf(game.loc) > 0)) {
771         rspeak(YOU_HAVEIT);
772         return GO_CLEAROBJ;
773     }
774
775
776     rspeak(actions[verb].message);
777     return GO_CLEAROBJ;
778 }
779
780 static int fly(token_t verb, token_t obj)
781 /* Fly.  Snide remarks unless hovering rug is here. */
782 {
783     if (obj == INTRANSITIVE) {
784         if (!HERE(RUG)) {
785             rspeak(FLAP_ARMS);
786             return GO_CLEAROBJ;
787         }
788         if (game.prop[RUG] != RUG_HOVER) {
789             rspeak(RUG_NOTHING2);
790             return GO_CLEAROBJ;
791         }
792         obj = RUG;
793     }
794
795     if (obj != RUG) {
796         rspeak(actions[verb].message);
797         return GO_CLEAROBJ;
798     }
799     if (game.prop[RUG] != RUG_HOVER) {
800         rspeak(RUG_NOTHING1);
801         return GO_CLEAROBJ;
802     }
803     game.oldlc2 = game.oldloc;
804     game.oldloc = game.loc;
805     /* FIXME: Arithmetic on location values */
806     game.newloc = game.place[RUG] + game.fixed[RUG] - game.loc;
807
808     if (game.prop[SAPPH] >= 0) {
809         rspeak(RUG_RETURNS);
810     } else {
811         rspeak(RUG_GOES);
812     }
813     return GO_TERMINATE;
814 }
815
816 static int inven(void)
817 /* Inventory. If object, treat same as find.  Else report on current burden. */
818 {
819     bool empty = true;
820     for (int i = 1; i <= NOBJECTS; i++) {
821         if (i == BEAR ||
822             !TOTING(i))
823             continue;
824         if (empty) {
825             rspeak(NOW_HOLDING);
826             empty = false;
827         }
828         pspeak(i, touch, -1, false);
829     }
830     if (TOTING(BEAR))
831         rspeak(TAME_BEAR);
832     if (empty)
833         rspeak(NO_CARRY);
834     return GO_CLEAROBJ;
835 }
836
837 static int light(token_t verb, token_t obj)
838 /*  Light.  Applicable only to lamp and urn. */
839 {
840     if (obj == INTRANSITIVE) {
841         if (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0)
842             obj = LAMP;
843         if (HERE(URN) && game.prop[URN] == URN_DARK)
844             obj =  URN;
845         if (obj == INTRANSITIVE ||
846             (HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 &&
847              HERE(URN) && game.prop[URN] == URN_DARK))
848             return GO_UNKNOWN;
849     }
850
851     if (obj == URN) {
852         state_change(URN, game.prop[URN] == URN_EMPTY ?
853                      URN_EMPTY :
854                      URN_LIT);
855         return GO_CLEAROBJ;
856     } else {
857         if (obj != LAMP) {
858             rspeak(actions[verb].message);
859             return GO_CLEAROBJ;
860         }
861         if (game.limit < 0) {
862             rspeak(LAMP_OUT);
863             return GO_CLEAROBJ;
864         }
865         state_change(LAMP, LAMP_BRIGHT);
866         if (game.wzdark)
867             return GO_TOP;
868         else
869             return GO_CLEAROBJ;
870     }
871 }
872
873 static int listen(void)
874 /*  Listen.  Intransitive only.  Print stuff based on objsnd/locsnd. */
875 {
876     long sound = locations[game.loc].sound;
877     if (sound != SILENT) {
878         rspeak(sound);
879         if (!locations[game.loc].loud)
880             rspeak(NO_MESSAGE);
881         return GO_CLEAROBJ;
882     }
883     for (int i = 1; i <= NOBJECTS; i++) {
884         if (!HERE(i) ||
885             objects[i].sounds[0] == NULL ||
886             game.prop[i] < 0)
887             continue;
888         int mi =  game.prop[i];
889         if (i == BIRD)
890             mi += 3 * game.blooded;
891         long packed_zzword = token_to_packed(game.zzword);
892         pspeak(i, hear, mi, true, packed_zzword);
893         rspeak(NO_MESSAGE);
894         /* FIXME: Magic number, sensitive to bird state logic */
895         if (i == BIRD && game.prop[i] == 5)
896             DESTROY(BIRD);
897         return GO_CLEAROBJ;
898     }
899     rspeak(ALL_SILENT);
900     return GO_CLEAROBJ;
901 }
902
903 static int lock(token_t verb, token_t obj)
904 /* Lock, unlock, no object given.  Assume various things if present. */
905 {
906     if (obj == INTRANSITIVE) {
907         if (HERE(CLAM))
908             obj = CLAM;
909         if (HERE(OYSTER))
910             obj = OYSTER;
911         if (AT(DOOR))
912             obj = DOOR;
913         if (AT(GRATE))
914             obj = GRATE;
915         if (HERE(CHAIN))
916             obj = CHAIN;
917         if (obj == INTRANSITIVE) {
918             rspeak(NOTHING_LOCKED);
919             return GO_CLEAROBJ;
920         }
921     }
922
923     /*  Lock, unlock object.  Special stuff for opening clam/oyster
924      *  and for chain. */
925     if (obj == GRATE ||
926         obj == CHAIN) {
927         if (HERE(KEYS)) {
928             if (obj == CHAIN)
929                 return chain(verb);
930             if (game.closng) {
931                 rspeak(EXIT_CLOSED);
932                 if (!game.panic)
933                     game.clock2 = PANICTIME;
934                 game.panic = true;
935                 return GO_CLEAROBJ ;
936             } else {
937                 state_change(GRATE, (verb == LOCK) ?
938                              GRATE_CLOSED :
939                              GRATE_OPEN);
940                 return GO_CLEAROBJ;
941             }
942         }
943         rspeak(NO_KEYS);
944         return GO_CLEAROBJ;
945     }
946
947     switch (obj) {
948     case CLAM:
949     case OYSTER:
950         return bivalve(verb, obj);
951     case DOOR:
952         rspeak((game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR);
953         break;
954     case CAGE:
955         rspeak( NO_LOCK);
956         break;
957     case KEYS:
958         rspeak(CANNOT_UNLOCK);
959         break;
960     default:
961         rspeak(actions[verb].message);
962     }
963
964     return GO_CLEAROBJ;
965 }
966
967 static int pour(token_t verb, token_t obj)
968 /*  Pour.  If no object, or object is bottle, assume contents of bottle.
969  *  special tests for pouring water or oil on plant or rusty door. */
970 {
971     if (obj == BOTTLE ||
972         obj == NO_OBJECT)
973         obj = LIQUID();
974     if (obj == NO_OBJECT)
975         return GO_UNKNOWN;
976     if (!TOTING(obj)) {
977         rspeak(actions[verb].message);
978         return GO_CLEAROBJ;
979     }
980
981     if (obj != OIL && obj != WATER) {
982         rspeak(CANT_POUR);
983         return GO_CLEAROBJ;
984     }
985     if (HERE(URN) && game.prop[URN] == URN_EMPTY)
986         return fill(verb, URN);
987     game.prop[BOTTLE] = EMPTY_BOTTLE;
988     game.place[obj] = LOC_NOWHERE;
989     if (!(AT(PLANT) ||
990           AT(DOOR))) {
991         rspeak(GROUND_WET);
992         return GO_CLEAROBJ;
993     }
994     if (!AT(DOOR)) {
995         if (obj == WATER) {
996             /* cycle through the three plant states */
997             state_change(PLANT, MOD(game.prop[PLANT] + 1, 3));
998             game.prop[PLANT2] = game.prop[PLANT];
999             return GO_MOVE;
1000         } else {
1001             rspeak(SHAKING_LEAVES);
1002             return GO_CLEAROBJ;
1003         }
1004     } else {
1005         state_change(DOOR, (obj == OIL) ?
1006                      DOOR_UNRUSTED :
1007                      DOOR_RUSTED);
1008         return GO_CLEAROBJ;
1009     }
1010 }
1011
1012 static int quit(void)
1013 /*  Quit.  Intransitive only.  Verify intent and exit if that's what he wants. */
1014 {
1015     if (yes(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
1016         terminate(quitgame);
1017     return GO_CLEAROBJ;
1018 }
1019
1020 static int read(struct command_t command)
1021 /*  Read.  Print stuff based on objtxt.  Oyster (?) is special case. */
1022 {
1023     if (command.obj == INTRANSITIVE) {
1024         command.obj = 0;
1025         for (int i = 1; i <= NOBJECTS; i++) {
1026             if (HERE(i) && objects[i].texts[0] != NULL && game.prop[i] >= 0)
1027                 command.obj = command.obj * NOBJECTS + i;
1028         }
1029         if (command.obj > NOBJECTS ||
1030             command.obj == 0 ||
1031             DARK(game.loc))
1032             return GO_UNKNOWN;
1033     }
1034
1035     if (DARK(game.loc)) {
1036         sspeak(NO_SEE, command.raw1);
1037     } else if (command.obj == OYSTER && !game.clshnt && game.closed) {
1038         game.clshnt = yes(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
1039     } else if (objects[command.obj].texts[0] == NULL ||
1040                game.prop[command.obj] < 0) {
1041         rspeak(actions[command.verb].message);
1042     } else
1043         pspeak(command.obj, study, game.prop[command.obj], true);
1044     return GO_CLEAROBJ;
1045 }
1046
1047 static int reservoir(void)
1048 /*  Z'ZZZ (word gets recomputed at startup; different each game). */
1049 {
1050     /* FIXME: Arithmetic on state numbers */
1051     if (!AT(RESER) && game.loc != game.fixed[RESER] - 1) {
1052         rspeak(NOTHING_HAPPENS);
1053         return GO_CLEAROBJ;
1054     } else {
1055         /* FIXME: Arithmetic on state numbers */
1056         pspeak(RESER, look, game.prop[RESER] + 1, true);
1057         game.prop[RESER] = 1 - game.prop[RESER];
1058         if (AT(RESER))
1059             return GO_CLEAROBJ;
1060         else {
1061             game.oldlc2 = game.loc;
1062             game.newloc = LOC_NOWHERE;
1063             rspeak(NOT_BRIGHT);
1064             return GO_TERMINATE;
1065         }
1066     }
1067 }
1068
1069 static int rub(token_t verb, token_t obj)
1070 /* Rub.  Yields various snide remarks except for lit urn. */
1071 {
1072     if (obj == URN && game.prop[URN] == URN_LIT) {
1073         DESTROY(URN);
1074         drop(AMBER, game.loc);
1075         game.prop[AMBER] = AMBER_IN_ROCK;
1076         --game.tally;
1077         drop(CAVITY, game.loc);
1078         rspeak(URN_GENIES);
1079     } else if (obj != LAMP) {
1080         rspeak(PECULIAR_NOTHING);
1081     } else {
1082         rspeak(actions[verb].message);
1083     }
1084     return GO_CLEAROBJ;
1085 }
1086
1087 static int say(struct command_t *command)
1088 /* Say.  Echo WD2 (or WD1 if no WD2 (SAY WHAT?, etc.).)  Magic words override. */
1089 {
1090     if (command->wd2 > 0) {
1091         command->wd1 = command->wd2;
1092         strcpy(command->raw1, command->raw2);
1093     }
1094     char word1[TOKLEN + 1];
1095     packed_to_token(command->wd1, word1);
1096     int wd = (int) get_vocab_id(word1);
1097     /* FIXME: magic numbers */
1098     if (wd == MOTION_WORD(XYZZY) ||
1099         wd == MOTION_WORD(PLUGH) ||
1100         wd == MOTION_WORD(PLOVER) ||
1101         wd == ACTION_WORD(GIANTWORDS) ||
1102         wd == ACTION_WORD(PART)) {
1103         /* FIXME: scribbles on the interpreter's command block */
1104         wordclear(&command->wd2);
1105         return GO_LOOKUP;
1106     }
1107     sspeak(OKEY_DOKEY, command->raw1);
1108     return GO_CLEAROBJ;
1109 }
1110
1111 static int throw_support(long spk)
1112 {
1113     rspeak(spk);
1114     drop(AXE, game.loc);
1115     return GO_MOVE;
1116 }
1117
1118 static int throw (struct command_t *command)
1119 /*  Throw.  Same as discard unless axe.  Then same as attack except
1120  *  ignore bird, and if dwarf is present then one might be killed.
1121  *  (Only way to do so!)  Axe also special for dragon, bear, and
1122  *  troll.  Treasures special for troll. */
1123 {
1124     if (TOTING(ROD2) && command->obj == ROD && !TOTING(ROD))
1125         command->obj = ROD2;
1126     if (!TOTING(command->obj)) {
1127         rspeak(actions[command->verb].message);
1128         return GO_CLEAROBJ;
1129     }
1130     if (objects[command->obj].is_treasure && AT(TROLL)) {
1131         /*  Snarf a treasure for the troll. */
1132         drop(command->obj, LOC_NOWHERE);
1133         move(TROLL, LOC_NOWHERE);
1134         move(TROLL + NOBJECTS, LOC_NOWHERE);
1135         drop(TROLL2, objects[TROLL].plac);
1136         drop(TROLL2 + NOBJECTS, objects[TROLL].fixd);
1137         juggle(CHASM);
1138         rspeak(TROLL_SATISFIED);
1139         return GO_CLEAROBJ;
1140     }
1141     if (command->obj == FOOD && HERE(BEAR)) {
1142         /* But throwing food is another story. */
1143         command->obj = BEAR;
1144         return (feed(command->verb, command->obj));
1145     }
1146     if (command->obj != AXE)
1147         return (discard(command->verb, command->obj, false));
1148     else {
1149         if (atdwrf(game.loc) <= 0) {
1150             if (AT(DRAGON) && game.prop[DRAGON] == DRAGON_BARS)
1151                 return throw_support(DRAGON_SCALES);
1152             if (AT(TROLL))
1153                 return throw_support(TROLL_RETURNS);
1154             else if (AT(OGRE))
1155                 return throw_support(OGRE_DODGE);
1156             else if (HERE(BEAR) && game.prop[BEAR] == UNTAMED_BEAR) {
1157                 /* This'll teach him to throw the axe at the bear! */
1158                 drop(AXE, game.loc);
1159                 game.fixed[AXE] = -1;
1160                 juggle(BEAR);
1161                 state_change(AXE, AXE_LOST);
1162                 return GO_CLEAROBJ;
1163             }
1164             command->obj = NO_OBJECT;
1165             return (attack(command));
1166         }
1167
1168         if (randrange(NDWARVES + 1) < game.dflag) {
1169             return throw_support(DWARF_DODGES);
1170         } else {
1171             long i = atdwrf(game.loc);
1172             game.dseen[i] = false;
1173             game.dloc[i] = LOC_NOWHERE;
1174             return throw_support((++game.dkill == 1) ?
1175                                  DWARF_SMOKE :
1176                                  KILLED_DWARF);
1177         }
1178     }
1179 }
1180
1181 static int wake(token_t verb, token_t obj)
1182 /* Wake.  Only use is to disturb the dwarves. */
1183 {
1184     if (obj != DWARF ||
1185         !game.closed) {
1186         rspeak(actions[verb].message);
1187         return GO_CLEAROBJ;
1188     } else {
1189         rspeak(PROD_DWARF);
1190         return GO_DWARFWAKE;
1191     }
1192 }
1193
1194 static int wave(token_t verb, token_t obj)
1195 /* Wave.  No effect unless waving rod at fissure or at bird. */
1196 {
1197     if (obj != ROD ||
1198         !TOTING(obj) ||
1199         (!HERE(BIRD) &&
1200          (game.closng ||
1201           !AT(FISSURE)))) {
1202         rspeak(((!TOTING(obj)) && (obj != ROD ||
1203                                    !TOTING(ROD2))) ?
1204                ARENT_CARRYING :
1205                actions[verb].message);
1206         return GO_CLEAROBJ;
1207     }
1208
1209     if (game.prop[BIRD] == BIRD_UNCAGED && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
1210         drop(JADE, game.loc);
1211         game.prop[JADE] = 0;
1212         --game.tally;
1213         rspeak(NECKLACE_FLY);
1214         return GO_CLEAROBJ;
1215     } else {
1216         if (game.closed) {
1217             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1218                    CAGE_FLY :
1219                    FREE_FLY);
1220             return GO_DWARFWAKE;
1221         }
1222         if (game.closng ||
1223             !AT(FISSURE)) {
1224             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1225                    CAGE_FLY :
1226                    FREE_FLY);
1227             return GO_CLEAROBJ;
1228         }
1229         if (HERE(BIRD))
1230             rspeak((game.prop[BIRD] == BIRD_CAGED) ?
1231                    CAGE_FLY :
1232                    FREE_FLY);
1233
1234         state_change(FISSURE,
1235             game.prop[FISSURE] == BRIDGED ? UNBRIDGED : BRIDGED);
1236         return GO_CLEAROBJ;
1237     }
1238 }
1239
1240 int action(struct command_t *command)
1241 /*  Analyse a verb.  Remember what it was, go back for object if second word
1242  *  unless verb is "say", which snarfs arbitrary second word.
1243  */
1244 {
1245     if (command->part == unknown) {
1246         /*  Analyse an object word.  See if the thing is here, whether
1247          *  we've got a verb yet, and so on.  Object must be here
1248          *  unless verb is "find" or "invent(ory)" (and no new verb
1249          *  yet to be analysed).  Water and oil are also funny, since
1250          *  they are never actually dropped at any location, but might
1251          *  be here inside the bottle or urn or as a feature of the
1252          *  location. */
1253         if (HERE(command->obj))
1254             /* FALL THROUGH */;
1255         else if (command->obj == GRATE) {
1256             if (game.loc == LOC_START ||
1257                 game.loc == LOC_VALLEY ||
1258                 game.loc == LOC_SLIT) {
1259                 command->obj = DPRSSN;
1260             }
1261             if (game.loc == LOC_COBBLE ||
1262                 game.loc == LOC_DEBRIS ||
1263                 game.loc == LOC_AWKWARD ||
1264                 game.loc == LOC_BIRD ||
1265                 game.loc == LOC_PITTOP) {
1266                 command->obj = ENTRNC;
1267             }
1268         } else if (command->obj == DWARF && atdwrf(game.loc) > 0)
1269             /* FALL THROUGH */;
1270         else if ((LIQUID() == command->obj && HERE(BOTTLE)) ||
1271                  command->obj == LIQLOC(game.loc))
1272             /* FALL THROUGH */;
1273         else if (command->obj == OIL && HERE(URN) && game.prop[URN] != 0) {
1274             command->obj = URN;
1275             /* FALL THROUGH */;
1276         } else if (command->obj == PLANT && AT(PLANT2) && game.prop[PLANT2] != 0) {
1277             command->obj = PLANT2;
1278             /* FALL THROUGH */;
1279         } else if (command->obj == KNIFE && game.knfloc == game.loc) {
1280             game.knfloc = -1;
1281             rspeak(KNIVES_VANISH);
1282             return GO_CLEAROBJ;
1283         } else if (command->obj == ROD && HERE(ROD2)) {
1284             command->obj = ROD2;
1285             /* FALL THROUGH */;
1286         } else if ((command->verb == FIND ||
1287                     command->verb == INVENTORY) && command->wd2 <= 0)
1288             /* FALL THROUGH */;
1289         else {
1290             sspeak(NO_SEE, command->raw1);
1291             return GO_CLEAROBJ;
1292         }
1293
1294         if (command->wd2 > 0)
1295             return GO_WORD2;
1296         if (command->verb != 0)
1297             command->part = transitive;
1298     }
1299
1300     switch (command->part) {
1301     case intransitive:
1302         if (command->wd2 > 0 && command->verb != SAY)
1303             return GO_WORD2;
1304         if (command->verb == SAY)
1305             command->obj = command->wd2;
1306         if (command->obj == 0 ||
1307             command->obj == INTRANSITIVE) {
1308             /*  Analyse an intransitive verb (ie, no object given yet). */
1309             switch (command->verb) {
1310             case CARRY:
1311                 return vcarry(command->verb, INTRANSITIVE);
1312             case  DROP:
1313                 return GO_UNKNOWN;
1314             case  SAY:
1315                 return GO_UNKNOWN;
1316             case  UNLOCK:
1317                 return lock(command->verb, INTRANSITIVE);
1318             case  NOTHING: {
1319                 rspeak(OK_MAN);
1320                 return (GO_CLEAROBJ);
1321             }
1322             case  LOCK:
1323                 return lock(command->verb, INTRANSITIVE);
1324             case  LIGHT:
1325                 return light(command->verb, INTRANSITIVE);
1326             case  EXTINGUISH:
1327                 return extinguish(command->verb, INTRANSITIVE);
1328             case  WAVE:
1329                 return GO_UNKNOWN;
1330             case  TAME:
1331                 return GO_UNKNOWN;
1332             case GO: {
1333                 rspeak(actions[command->verb].message);
1334                 return GO_CLEAROBJ;
1335             }
1336             case ATTACK:
1337                 return attack(command);
1338             case POUR:
1339                 return pour(command->verb, command->obj);
1340             case EAT:
1341                 return eat(command->verb, INTRANSITIVE);
1342             case DRINK:
1343                 return drink(command->verb, command->obj);
1344             case RUB:
1345                 return GO_UNKNOWN;
1346             case THROW:
1347                 return GO_UNKNOWN;
1348             case QUIT:
1349                 return quit();
1350             case FIND:
1351                 return GO_UNKNOWN;
1352             case INVENTORY:
1353                 return inven();
1354             case FEED:
1355                 return GO_UNKNOWN;
1356             case FILL:
1357                 return fill(command->verb, command->obj);
1358             case BLAST:
1359                 blast();
1360                 return GO_CLEAROBJ;
1361             case SCORE:
1362                 score(scoregame);
1363                 return GO_CLEAROBJ;
1364             case GIANTWORDS:
1365                 return bigwords(command->wd1);
1366             case BRIEF:
1367                 return brief();
1368             case READ:
1369                 command->obj = INTRANSITIVE;
1370                 return read(*command);
1371             case BREAK:
1372                 return GO_UNKNOWN;
1373             case WAKE:
1374                 return GO_UNKNOWN;
1375             case SAVE:
1376                 return suspend();
1377             case RESUME:
1378                 return resume();
1379             case FLY:
1380                 return fly(command->verb, INTRANSITIVE);
1381             case LISTEN:
1382                 return listen();
1383             case PART:
1384                 return reservoir();
1385             default:
1386                 BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
1387             }
1388         }
1389     /* FALLTHRU */
1390     case transitive:
1391         /*  Analyse a transitive verb. */
1392         switch (command->verb) {
1393         case  CARRY:
1394             return vcarry(command->verb, command->obj);
1395         case  DROP:
1396             return discard(command->verb, command->obj, false);
1397         case  SAY:
1398             return say(command);
1399         case  UNLOCK:
1400             return lock(command->verb, command->obj);
1401         case  NOTHING: {
1402             rspeak(OK_MAN);
1403             return (GO_CLEAROBJ);
1404         }
1405         case  LOCK:
1406             return lock(command->verb, command->obj);
1407         case LIGHT:
1408             return light(command->verb, command->obj);
1409         case EXTINGUISH:
1410             return extinguish(command->verb, command->obj);
1411         case WAVE:
1412             return wave(command->verb, command->obj);
1413         case TAME: {
1414             rspeak(actions[command->verb].message);
1415             return GO_CLEAROBJ;
1416         }
1417         case GO: {
1418             rspeak(actions[command->verb].message);
1419             return GO_CLEAROBJ;
1420         }
1421         case ATTACK:
1422             return attack(command);
1423         case POUR:
1424             return pour(command->verb, command->obj);
1425         case EAT:
1426             return eat(command->verb, command->obj);
1427         case DRINK:
1428             return drink(command->verb, command->obj);
1429         case RUB:
1430             return rub(command->verb, command->obj);
1431         case THROW:
1432             return throw (command);
1433         case QUIT: {
1434             rspeak(actions[command->verb].message);
1435             return GO_CLEAROBJ;
1436         }
1437         case FIND:
1438             return find(command->verb, command->obj);
1439         case INVENTORY:
1440             return find(command->verb, command->obj);
1441         case FEED:
1442             return feed(command->verb, command->obj);
1443         case FILL:
1444             return fill(command->verb, command->obj);
1445         case BLAST:
1446             blast();
1447             return GO_CLEAROBJ;
1448         case SCORE: {
1449             rspeak(actions[command->verb].message);
1450             return GO_CLEAROBJ;
1451         }
1452         case GIANTWORDS: {
1453             rspeak(actions[command->verb].message);
1454             return GO_CLEAROBJ;
1455         }
1456         case BRIEF: {
1457             rspeak(actions[command->verb].message);
1458             return GO_CLEAROBJ;
1459         }
1460         case READ:
1461             return read(*command);
1462         case BREAK:
1463             return vbreak(command->verb, command->obj);
1464         case WAKE:
1465             return wake(command->verb, command->obj);
1466         case SAVE: {
1467             rspeak(actions[command->verb].message);
1468             return GO_CLEAROBJ;
1469         }
1470         case RESUME: {
1471             rspeak(actions[command->verb].message);
1472             return GO_CLEAROBJ;
1473         }
1474         case FLY:
1475             return fly(command->verb, command->obj);
1476         case LISTEN: {
1477             rspeak(actions[command->verb].message);
1478             return GO_CLEAROBJ;
1479         }
1480         case PART:
1481             return reservoir();
1482         default:
1483             BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST); // LCOV_EXCL_LINE
1484         }
1485     case unknown:
1486         /* Unknown verb, couldn't deduce object - might need hint */
1487         sspeak(WHAT_DO, command->raw1);
1488         return GO_CHECKHINT;
1489     default:
1490         BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN); // LCOV_EXCL_LINE
1491     }
1492 }