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