fixed issue with get_direction
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user