From 13519b619d0a8af3f262ccf05118c0d00bf8f14f Mon Sep 17 00:00:00 2001 From: a25liang Date: Fri, 5 Jul 2024 18:28:34 -0400 Subject: [PATCH] fixed issue with get_direction --- src/input.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/input.cc b/src/input.cc index f7ec28b..2336630 100644 --- a/src/input.cc +++ b/src/input.cc @@ -4,13 +4,11 @@ const char *COMMANDS[] = { "no", "so", "ea", "we", "ne", "nw", "se", "sw" }; -const int COMMANDS_CNT = 11; +const int COMMANDS_CNT = 8; game_command get_direction(std::string &str) { for (int i = 0; i < COMMANDS_CNT; ++i) - if (str == COMMANDS[i] && - i >= game_command::move_north && - i <= game_command::move_southeast) + if (str == COMMANDS[i]) return (game_command)i; return game_command_panic;