X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=main.c;h=9cb04979b92f68be6b9a0a908837a03856776fc8;hb=8b1533db1a9d9af1801221d8b31bb5a700ae928d;hp=caa328d28e49767757e046f916293aec792ab126;hpb=5c30d6429f4f5e3d187d52b6ac623d61968738a4;p=open-adventure.git diff --git a/main.c b/main.c index caa328d..9cb0497 100644 --- a/main.c +++ b/main.c @@ -968,7 +968,7 @@ static void listobjects(void) static bool do_command() /* Get and execute a command */ { - static struct command_t command; + static command_t command; /* Can't leave cave once it's closing (except by main office). */ if (OUTSID(game.newloc) && game.newloc != 0 && game.closng) { @@ -1051,18 +1051,26 @@ Lclearobj: game.knfloc = 0; /* Preserve state from last command for reuse when required */ - struct command_t preserve; - memcpy(&preserve, &command, sizeof(struct command_t)); + command_t preserve; + memcpy(&preserve, &command, sizeof(command_t)); // Get command input from user if (!get_command_input(&command)) return false; #ifdef GDEBUG - printf("Preserve: type1 = %u, id1 = %ld, type2 = %u, id2 = %ld\n", - preserve.word[0].type, preserve.word[0].id, preserve.word[1].type, preserve.word[1].id); - printf("Command: type1 = %u, id1 = %ld, type2 = %u, id2 = %ld\n", - command.word[0].type, command.word[0].id, 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"}; + printf("Preserve: type1 = %s, id1 = %ld, type2 = %s, id2 = %ld\n", + types[preserve.word[0].type], + preserve.word[0].id, + types[preserve.word[1].type], + preserve.word[1].id); + printf("Command: type1 = %s, id1 = %ld, type2 = %s, id2 = %ld\n", + 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 */