fix weird interference with polls
This commit is contained in:
parent
881d3602e7
commit
be291628b8
2 changed files with 9 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
#include <time.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -177,6 +178,8 @@ int suggest_command(char *command, char *command_re, hashmap *polls, hashmap *co
|
||||||
char *val = calloc(MAX_BUF_LENGTH, sizeof(char));
|
char *val = calloc(MAX_BUF_LENGTH, sizeof(char));
|
||||||
sprintf(val, "%s;%s", page, command_re);
|
sprintf(val, "%s;%s", page, command_re);
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
|
|
||||||
char *key = calloc(MAX_BUF_LENGTH, sizeof(char));
|
char *key = calloc(MAX_BUF_LENGTH, sizeof(char));
|
||||||
sprintf(key, "%s_%i", name, (int)rand());
|
sprintf(key, "%s_%i", name, (int)rand());
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
|
#include "map.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -87,8 +88,11 @@ int main(int argc, char *argv[]) {
|
||||||
was_combination = 0;
|
was_combination = 0;
|
||||||
if (help_command(command))
|
if (help_command(command))
|
||||||
continue;
|
continue;
|
||||||
if (polls_command(command, polls, elements))
|
if (polls_command(command, polls, elements)) {
|
||||||
continue;
|
hashmap_free(polls);
|
||||||
|
polls = hashmap_create();
|
||||||
|
init_tables(elements, inv, polls, elements_rev, 0);
|
||||||
|
}
|
||||||
if (slash_command(command, inv))
|
if (slash_command(command, inv))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue