don't show paths of elements you don't have
Това подаване се съдържа в:
родител
053b04133a
подаване
7a63fcb376
3 променени файла с 13 добавяния и 4 изтривания
|
@ -238,7 +238,7 @@ int polls_command(char *command, hashmap *polls, hashmap *cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int path_command(char *command, hashmap *elements_rev, hashmap *already_done,
|
int path_command(char *command, hashmap *elements_rev, hashmap *already_done,
|
||||||
int top) {
|
int top, hashmap* inv) {
|
||||||
char *page2;
|
char *page2;
|
||||||
if (top) {
|
if (top) {
|
||||||
page2 = handle_pages(command, "/path ");
|
page2 = handle_pages(command, "/path ");
|
||||||
|
@ -263,7 +263,15 @@ int path_command(char *command, hashmap *elements_rev, hashmap *already_done,
|
||||||
already_done = hashmap_create();
|
already_done = hashmap_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uintptr_t result;
|
uintptr_t result;
|
||||||
|
hashmap_get(inv, page, strlen(page), &result);
|
||||||
|
|
||||||
|
if (top && result != 1) {
|
||||||
|
printf("You don't have %s.\n", page);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
hashmap_get(already_done, page, strlen(page), &result);
|
hashmap_get(already_done, page, strlen(page), &result);
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
|
@ -303,7 +311,7 @@ int path_command(char *command, hashmap *elements_rev, hashmap *already_done,
|
||||||
strstrd[0] = '\0';
|
strstrd[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
path_command(tmp23, elements_rev, already_done, 0);
|
path_command(tmp23, elements_rev, already_done, 0, inv);
|
||||||
|
|
||||||
if (strlen(tmp23) < 1) {
|
if (strlen(tmp23) < 1) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -6,4 +6,4 @@ int suggest_command(char *command, char *command_re, hashmap *polls,
|
||||||
int help_command(char *command);
|
int help_command(char *command);
|
||||||
int polls_command(char *command, hashmap *polls, hashmap *cmd);
|
int polls_command(char *command, hashmap *polls, hashmap *cmd);
|
||||||
int path_command(char *command, hashmap *elements_rev, hashmap *already_done,
|
int path_command(char *command, hashmap *elements_rev, hashmap *already_done,
|
||||||
int top);
|
int top, hashmap *inv);
|
|
@ -91,7 +91,8 @@ int main(int argc, char *argv[]) {
|
||||||
continue;
|
continue;
|
||||||
if (slash_command(command, inv))
|
if (slash_command(command, inv))
|
||||||
continue;
|
continue;
|
||||||
if (path_command(command, elements_rev, already_done, 1))
|
|
||||||
|
if (path_command(command, elements_rev, already_done, 1, inv))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int combos = get_command(command, command_re, sort_tmp);
|
int combos = get_command(command, command_re, sort_tmp);
|
||||||
|
|
Зареждане…
Препратка в нова задача