Reindentation

This commit is contained in:
NHOrus 2017-08-13 15:56:07 +01:00
parent f0dc3d3b7c
commit 0fbd79b608
4 changed files with 72 additions and 73 deletions

76
main.c
View file

@ -1050,43 +1050,43 @@ Lclearobj:
if (game.knfloc > 0 && game.knfloc != game.loc)
game.knfloc = 0;
/* Preserve state from last command for reuse when required */
command_t preserve = command;
/* Preserve state from last command for reuse when required */
command_t preserve = command;
// Get command input from user
// Get command input from user
if (!get_command_input(&command))
return false;
#ifdef GDEBUG
/* Needs to stay synced with enum word_type_t */
const char *types[] = {"NO_WORD_TYPE", "MOTION", "OBJECT", "ACTION", "NUMERIC"};
/* needs to stay synced with enum speechpart */
const char *roles[] = {"unknown", "intransitive", "transitive"};
printf("Preserve: role = %s type1 = %s, id1 = %ld, type2 = %s, id2 = %ld\n",
roles[preserve.part],
types[preserve.word[0].type],
preserve.word[0].id,
types[preserve.word[1].type],
preserve.word[1].id);
printf("Command: role = %s type1 = %s, id1 = %ld, type2 = %s, id2 = %ld\n",
roles[command.part],
types[command.word[0].type],
command.word[0].id,
types[command.word[1].type],
command.word[1].id);
/* Needs to stay synced with enum word_type_t */
const char *types[] = {"NO_WORD_TYPE", "MOTION", "OBJECT", "ACTION", "NUMERIC"};
/* needs to stay synced with enum speechpart */
const char *roles[] = {"unknown", "intransitive", "transitive"};
printf("Preserve: role = %s type1 = %s, id1 = %ld, type2 = %s, id2 = %ld\n",
roles[preserve.part],
types[preserve.word[0].type],
preserve.word[0].id,
types[preserve.word[1].type],
preserve.word[1].id);
printf("Command: role = %s type1 = %s, id1 = %ld, type2 = %s, id2 = %ld\n",
roles[command.part],
types[command.word[0].type],
command.word[0].id,
types[command.word[1].type],
command.word[1].id);
#endif
/* Handle of objectless action followed by actionless object */
if (preserve.word[0].type == ACTION && preserve.word[1].type == NO_WORD_TYPE && command.word[1].id == 0)
command.verb = preserve.verb;
/* Handle of objectless action followed by actionless object */
if (preserve.word[0].type == ACTION && preserve.word[1].type == NO_WORD_TYPE && command.word[1].id == 0)
command.verb = preserve.verb;
#ifdef BROKEN
/* Handling of actionless object followed by objectless action */
if (preserve.type1 == OBJECT && preserve.type2 == NO_WORD_TYPE && command.id2 == 0)
command.obj = preserve.obj;
/* Handling of actionless object followed by objectless action */
if (preserve.type1 == OBJECT && preserve.type2 == NO_WORD_TYPE && command.id2 == 0)
command.obj = preserve.obj;
#endif
++game.turns;
++game.turns;
if (closecheck()) {
if (game.closed)
@ -1122,8 +1122,8 @@ Lclearobj:
}
if ((command.word[0].id == WATER || command.word[0].id == OIL) && (command.word[1].id == PLANT || command.word[1].id == DOOR)) {
if (AT(command.word[1].id)) {
command.word[1] = command.word[0];
command.word[0].id = POUR;
command.word[1] = command.word[0];
command.word[0].id = POUR;
command.word[0].type = ACTION;
strncpy(command.word[0].raw, "pour", LINESIZE - 1);
}
@ -1133,12 +1133,12 @@ Lclearobj:
command.word[0].type = ACTION;
}
/* From OV to VO form */
if (command.word[0].type==OBJECT && command.word[1].type==ACTION) {
command_word_t stage = command.word[0];
command.word[0] = command.word[1];
command.word[1] = stage;
}
/* From OV to VO form */
if (command.word[0].type == OBJECT && command.word[1].type == ACTION) {
command_word_t stage = command.word[0];
command.word[0] = command.word[1];
command.word[1] = stage;
}
}
Lookup:
@ -1165,7 +1165,7 @@ Lookup:
command.obj = command.word[0].id;
break;
case ACTION:
if(command.word[1].type == NUMERIC)
if (command.word[1].type == NUMERIC)
command.part = transitive;
else
command.part = intransitive;
@ -1186,11 +1186,11 @@ Lookup:
continue; /* back to top of main interpreter loop */
case GO_WORD2:
#ifdef GDEBUG
printf("Word shift\n");
printf("Word shift\n");
#endif /* GDEBUG */
/* Get second word for analysis. */
command.word[0] = command.word[1];
command.word[1] = empty_command_word;
command.word[0] = command.word[1];
command.word[1] = empty_command_word;
goto Lookup;
case GO_UNKNOWN:
/* Random intransitive verbs come here. Clear obj just in case