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