- switch (action(&command)) {
- case GO_TERMINATE:
- return true;
- case GO_MOVE:
- playermove(NUL);
- return true;
- case GO_TOP:
- continue; /* back to top of main interpreter loop */
- case GO_LOOKUP:
- goto Lookup;
- case GO_WORD2:
- /* Get second word for analysis. */
- command.id1 = command.id2;
- command.type1 = command.type2;
- strncpy(command.raw1, command.raw2, LINESIZE - 1);
- command.wd1 = command.wd2;
- command.id2 = WORD_EMPTY;
- command.type2 = NO_WORD_TYPE;
- command.raw2[0] = '\0';
- wordclear(&command.wd2);
- goto Lookup;
- case GO_UNKNOWN:
- /* Random intransitive verbs come here. Clear obj just in case
- * (see attack()). */
- command.raw1[0] = toupper(command.raw1[0]);
- sspeak(DO_WHAT, command.raw1);
- command.obj = 0;
- // Fallthrough
- case GO_CHECKHINT: // Fallthrough
- case GO_CLEAROBJ:
- goto Lclearobj;
- case GO_DWARFWAKE:
- /* Oh dear, he's disturbed the dwarves. */
- rspeak(DWARVES_AWAKEN);
- terminate(endgame);
- default: // LCOV_EXCL_LINE
- BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
- }
- }
+ /* Give user hints of shortcuts */
+ if (strncasecmp(command.word[0].raw, "west", sizeof("west")) == 0) {
+ if (++game.iwest == 10)
+ rspeak(W_IS_WEST);
+ }
+ if (strncasecmp(command.word[0].raw, "go", sizeof("go")) == 0 && command.word[1].id != WORD_EMPTY) {
+ if (++game.igo == 10)
+ rspeak(GO_UNNEEDED);
+ }
+
+ switch (command.word[0].type) {
+ case MOTION:
+ playermove(command.word[0].id);
+ command.state = EXECUTED;
+ continue;
+ case OBJECT:
+ command.part = unknown;
+ command.obj = command.word[0].id;
+ break;
+ case ACTION:
+ if (command.word[1].type == NUMERIC)
+ command.part = transitive;
+ else
+ command.part = intransitive;
+ command.verb = command.word[0].id;
+ break;
+ case NUMERIC:
+ if (!settings.oldstyle) {
+ sspeak(DONT_KNOW, command.word[0].raw);
+ clear_command(&command);
+ continue;
+ }
+ break;// LCOV_EXCL_LINE
+ default: // LCOV_EXCL_LINE
+ case NO_WORD_TYPE: // LCOV_EXCL_LINE
+ BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE
+ }
+
+ switch (action(command)) {
+ case GO_TERMINATE:
+ command.state = EXECUTED;
+ break;
+ case GO_MOVE:
+ playermove(NUL);
+ command.state = EXECUTED;
+ break;
+ case GO_WORD2:
+#ifdef GDEBUG
+ printf("Word shift\n");
+#endif /* GDEBUG */
+ /* Get second word for analysis. */
+ command.word[0] = command.word[1];
+ command.word[1] = empty_command_word;
+ command.state = PREPROCESSED;
+ break;
+ case GO_UNKNOWN:
+ /* Random intransitive verbs come here. Clear obj just in case
+ * (see attack()). */
+ command.word[0].raw[0] = toupper(command.word[0].raw[0]);
+ sspeak(DO_WHAT, command.word[0].raw);
+ command.obj = NO_OBJECT;
+
+ /* object cleared; we need to go back to the preprocessing step */
+ command.state = GIVEN;
+ break;
+ case GO_CHECKHINT: // FIXME: re-name to be more contextual; this was previously a label
+ command.state = GIVEN;
+ break;
+ case GO_DWARFWAKE:
+ /* Oh dear, he's disturbed the dwarves. */
+ rspeak(DWARVES_AWAKEN);
+ terminate(endgame);
+ case GO_CLEAROBJ: // FIXME: re-name to be more contextual; this was previously a label
+ clear_command(&command);
+ break;
+ case GO_TOP: // FIXME: re-name to be more contextual; this was previously a label
+ break;
+ default: // LCOV_EXCL_LINE
+ BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
+ }
+ } /* while command has nob been fully processed */
+ } /* while command is not yet given */
+ } /* while command is not executed */
+
+ /* command completely executed; we return true. */
+ return true;