check both main dir and parent dir (temp fix)
This commit is contained in:
parent
f4be64fe19
commit
4bef1a220c
3 changed files with 29 additions and 10 deletions
15
src/main.c
15
src/main.c
|
@ -16,8 +16,9 @@ int main(int argc, char *argv[]) {
|
|||
char *command_re = calloc(MAX_BUF_LENGTH, sizeof(char));
|
||||
char **sort_tmp = calloc(MAX_COMBO_LENGTH, sizeof(char **));
|
||||
|
||||
load_elements(elements, "bin/combos.txt", 0);
|
||||
load_elements(inv, "bin/inv.txt", 1);
|
||||
load_elements(elements, "combos.txt", 0) ||
|
||||
load_elements(elements, "bin/combos.txt", 0);
|
||||
load_elements(inv, "inv.txt", 1) || load_elements(inv, "bin/inv.txt", 1);
|
||||
|
||||
printf("Welcome to Elemental on Command Line!\n");
|
||||
while (1) {
|
||||
|
@ -25,15 +26,16 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
printf("\n");
|
||||
fgets(command, MAX_BUF_LENGTH - 1, stdin);
|
||||
int slashRan = slash_command(command,inv);
|
||||
if (slashRan) continue;
|
||||
int slashRan = slash_command(command, inv);
|
||||
if (slashRan)
|
||||
continue;
|
||||
|
||||
int combos = get_command(command, command_re, sort_tmp);
|
||||
|
||||
int failed = 0;
|
||||
for (int i = 0; i < combos; i++) {
|
||||
uintptr_t result;
|
||||
hashmap_get(inv, sort_tmp[i], strlen(sort_tmp[i]) - 1, &result);
|
||||
hashmap_get(inv, sort_tmp[i], strlen(sort_tmp[i]) - 1, &result);
|
||||
if (result != 1) {
|
||||
printf("You don't have %s.\n", sort_tmp[i]);
|
||||
failed = 1;
|
||||
|
@ -41,7 +43,8 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
if (failed) continue;
|
||||
if (failed)
|
||||
continue;
|
||||
|
||||
uintptr_t result;
|
||||
hashmap_get(elements, command_re, strlen(command_re), &result);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue