From be291628b81efe26989c2a25f59d9f169a0d4f39 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Mon, 14 Apr 2025 20:36:53 -0400 Subject: [PATCH] fix weird interference with polls --- src/command.c | 3 +++ src/main.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/command.c b/src/command.c index c89104e..aab75ef 100644 --- a/src/command.c +++ b/src/command.c @@ -1,4 +1,5 @@ #include "map.h" +#include #include #include #include @@ -177,6 +178,8 @@ int suggest_command(char *command, char *command_re, hashmap *polls, hashmap *co char *val = calloc(MAX_BUF_LENGTH, sizeof(char)); sprintf(val, "%s;%s", page, command_re); + srand(time(NULL)); + char *key = calloc(MAX_BUF_LENGTH, sizeof(char)); sprintf(key, "%s_%i", name, (int)rand()); diff --git a/src/main.c b/src/main.c index 67e3c96..0028bb7 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include "command.h" #include "loader.h" +#include "map.h" #include #include #include @@ -87,8 +88,11 @@ int main(int argc, char *argv[]) { was_combination = 0; if (help_command(command)) continue; - if (polls_command(command, polls, elements)) - continue; + if (polls_command(command, polls, elements)) { + hashmap_free(polls); + polls = hashmap_create(); + init_tables(elements, inv, polls, elements_rev, 0); + } if (slash_command(command, inv)) continue;