moved get_direction from *_input.cc to input.h

This commit is contained in:
2024-07-04 23:15:47 -04:00
parent f5b5f180a0
commit e55be26b27
4 changed files with 16 additions and 22 deletions

12
src/input.cc Normal file
View File

@ -0,0 +1,12 @@
#include "input.h"
game_command get_direction(std::string &str, const char *COMMANDS[],
const int COMMANDS_CNT) {
for (int i = 0; i < COMMANDS_CNT; ++i)
if (str == COMMANDS[i] &&
i >= game_command::move_north &&
i <= game_command::move_southeast)
return (game_command)i;
return game_command_panic;
}