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