Eliminated "Lookup" label

This commit is contained in:
Aaron Traas 2018-11-19 14:52:13 -05:00
parent eb49f4d0d2
commit 16545a5765

13
main.c
View file

@ -983,6 +983,7 @@ static bool do_command()
/* Get and execute a command */ /* Get and execute a command */
{ {
static command_t command; static command_t command;
bool words_processed = false;
/* Can't leave cave once it's closing (except by main office). */ /* Can't leave cave once it's closing (except by main office). */
if (OUTSID(game.newloc) && game.newloc != 0 && game.closng) { if (OUTSID(game.newloc) && game.newloc != 0 && game.closng) {
@ -1138,7 +1139,11 @@ Lclosecheck:
} }
} }
Lookup: // loop until all words in command are procesed
do {
// assume all words in command are processed, until proven otherwise
words_processed = true;
if (strncasecmp(command.word[0].raw, "west", sizeof("west")) == 0) { if (strncasecmp(command.word[0].raw, "west", sizeof("west")) == 0) {
if (++game.iwest == 10) if (++game.iwest == 10)
rspeak(W_IS_WEST); rspeak(W_IS_WEST);
@ -1153,6 +1158,7 @@ Lookup:
clear_command(&command); clear_command(&command);
goto Lcheckhint; goto Lcheckhint;
} }
switch (command.word[0].type) { switch (command.word[0].type) {
case NO_WORD_TYPE: // FIXME: treating NO_WORD_TYPE as a motion word is confusing case NO_WORD_TYPE: // FIXME: treating NO_WORD_TYPE as a motion word is confusing
case MOTION: case MOTION:
@ -1178,6 +1184,7 @@ Lookup:
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE BUG(VOCABULARY_TYPE_N_OVER_1000_NOT_BETWEEN_0_AND_3); // LCOV_EXCL_LINE
} }
switch (action(command)) { switch (action(command)) {
case GO_TERMINATE: case GO_TERMINATE:
return true; return true;
@ -1198,7 +1205,8 @@ Lookup:
/* Get second word for analysis. */ /* Get second word for analysis. */
command.word[0] = command.word[1]; command.word[0] = command.word[1];
command.word[1] = empty_command_word; command.word[1] = empty_command_word;
goto Lookup; words_processed = false;
break;
case GO_UNKNOWN: case GO_UNKNOWN:
/* Random intransitive verbs come here. Clear obj just in case /* Random intransitive verbs come here. Clear obj just in case
* (see attack()). */ * (see attack()). */
@ -1213,6 +1221,7 @@ Lookup:
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
} }
} while (!words_processed);
} }
} }