edit: reworked how constants are defined

This commit is contained in:
2024-07-04 23:22:41 -04:00
parent e55be26b27
commit 325a1d1350
4 changed files with 18 additions and 22 deletions

View File

@ -1,7 +1,12 @@
#include "input.h"
game_command get_direction(std::string &str, const char *COMMANDS[],
const int COMMANDS_CNT) {
const char *COMMANDS[] = {
"no", "so", "ea", "we", "ne", "nw", "se", "sw"
};
const int COMMANDS_CNT = 11;
game_command get_direction(std::string &str) {
for (int i = 0; i < COMMANDS_CNT; ++i)
if (str == COMMANDS[i] &&
i >= game_command::move_north &&