From be291628b81efe26989c2a25f59d9f169a0d4f39 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Mon, 14 Apr 2025 20:36:53 -0400 Subject: [PATCH 1/6] 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; From 9b196f0b1328589fdb148df9640551f7c16c5c34 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Thu, 17 Apr 2025 09:27:13 -0400 Subject: [PATCH 2/6] fix weird newline issue --- src/loader.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/loader.c b/src/loader.c index 28668f5..a41a19d 100644 --- a/src/loader.c +++ b/src/loader.c @@ -26,7 +26,9 @@ int entry_handler(const void *key, size_t size, uintptr_t val, void *usr) { } } else if (usr2->mode == 1) { fwrite(key2, sizeof(char), strlen(key2), usr2->fptr); - fwrite("\n", sizeof(char), 1, usr2->fptr); + if (key2[strlen(key2) - 1] != '\n') { + fwrite("\n", sizeof(char), 1, usr2->fptr); + } } else { fwrite(key2, sizeof(char), strlen(key2), usr2->fptr); fwrite(";", sizeof(char), 1, usr2->fptr); From fac2179c233ba65bda87447154bdeb6ab4376128 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Thu, 17 Apr 2025 09:43:20 -0400 Subject: [PATCH 3/6] hopefully fix the paging issue --- src/command.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/command.c b/src/command.c index aab75ef..749cbdc 100644 --- a/src/command.c +++ b/src/command.c @@ -143,8 +143,13 @@ int success_handler(const void *key, size_t size, uintptr_t val, void *usr) { } char *handle_pages(char *command, char *invs) { + char *data; + char *data2; if (strncmp(command, invs, strlen(invs)) == 0) { - return &command[strlen(invs)]; + data = &command[strlen(invs)]; + data2 = malloc(strlen(data) + 1); + memcpy(data2,data,strlen(data) + 1); + return data2; } else { return 0; } From 692688dbbdcc635ba075d9c9db73c30bd8d54127 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sun, 20 Apr 2025 20:10:50 -0400 Subject: [PATCH 4/6] fix url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2904f8..c7ad847 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is an elemental combination game written in C, with optional multi-player s ## Clients - [PenguinMod client](https://studio.penguinmod.com/?fps=200&clones=Infinity&offscreen&size=850x480#7218964246) for playing the game online with a fancy interface - [Discord client](https://discord.gg/DKZTWyWH3B) for playing the game publicly with other Discord members -- [Web client](https://elem.dervland.net/) for a demo of the multiplayer version +- [Web client](https://elem.dervland.net/game/) for a demo of the multiplayer version - [Original client](https://git.dervland.net/elemental/elemental-on-terminal/releases) for developers, administrators, and command line fans ## Single-player From c7cbcd39ad805c66f20f21753fffb54c14ce7ebb Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sun, 20 Apr 2025 20:11:10 -0400 Subject: [PATCH 5/6] nvm --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c7ad847..b2904f8 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is an elemental combination game written in C, with optional multi-player s ## Clients - [PenguinMod client](https://studio.penguinmod.com/?fps=200&clones=Infinity&offscreen&size=850x480#7218964246) for playing the game online with a fancy interface - [Discord client](https://discord.gg/DKZTWyWH3B) for playing the game publicly with other Discord members -- [Web client](https://elem.dervland.net/game/) for a demo of the multiplayer version +- [Web client](https://elem.dervland.net/) for a demo of the multiplayer version - [Original client](https://git.dervland.net/elemental/elemental-on-terminal/releases) for developers, administrators, and command line fans ## Single-player From 40e38578bb60457997ef6d3f6c69e611bb7ebd1c Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sun, 20 Apr 2025 20:16:30 -0400 Subject: [PATCH 6/6] c --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2904f8..d5d6b6f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is an elemental combination game written in C, with optional multi-player s ## Clients - [PenguinMod client](https://studio.penguinmod.com/?fps=200&clones=Infinity&offscreen&size=850x480#7218964246) for playing the game online with a fancy interface - [Discord client](https://discord.gg/DKZTWyWH3B) for playing the game publicly with other Discord members -- [Web client](https://elem.dervland.net/) for a demo of the multiplayer version +- [Web client](https://elem.dervland.net/index.html) for a demo of the multiplayer version - [Original client](https://git.dervland.net/elemental/elemental-on-terminal/releases) for developers, administrators, and command line fans ## Single-player