From aa7859c9a009433cdb41a630fcdbd11fed57e0ee Mon Sep 17 00:00:00 2001 From: David Joslin Date: Sat, 4 Nov 2023 21:10:14 -0700 Subject: [PATCH] Adjustments to 'ChatUpdate-v3' --- src/pc/chat/chat_command.c | 1 - src/pc/cliopts.c | 4 ---- src/pc/cliopts.h | 1 - src/pc/djui/djui_chat_box.c | 2 +- src/pc/pc_main.c | 15 +-------------- 5 files changed, 2 insertions(+), 21 deletions(-) delete mode 100644 src/pc/chat/chat_command.c diff --git a/src/pc/chat/chat_command.c b/src/pc/chat/chat_command.c deleted file mode 100644 index 0519ecba..00000000 --- a/src/pc/chat/chat_command.c +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/pc/cliopts.c b/src/pc/cliopts.c index 42ef1368..3efd6a60 100644 --- a/src/pc/cliopts.c +++ b/src/pc/cliopts.c @@ -26,7 +26,6 @@ static void print_help(void) { printf("%-20s\tStarts the game and joins an existing server.\n", "--client IP PORT"); printf("%-20s\tStarts the game using a poolsize of your choice.\n", "--poolsize POOLSIZE"); printf("%-20s\tStarts the game with a specific playername.\n", "--playername PLAYERNAME"); - printf("%-20s\tStarts the game with a random playername.\n", "--randomplayername"); } static inline int arg_string(const char *name, const char *value, char *target, int maxLength) { @@ -91,9 +90,6 @@ bool parse_cli_opts(int argc, char* argv[]) { else if (strcmp(argv[i], "--playername") == 0 && (i + 1) < argc) arg_string("--playername", argv[++i], gCLIOpts.PlayerName, MAX_PLAYER_STRING); - else if (strcmp(argv[i], "--randomplayername") == 0) - gCLIOpts.RandomPlayerName = 1; - // Print help else if (strcmp(argv[i], "--help") == 0) { print_help(); diff --git a/src/pc/cliopts.h b/src/pc/cliopts.h index 3acfb4c8..6d729ba1 100644 --- a/src/pc/cliopts.h +++ b/src/pc/cliopts.h @@ -24,7 +24,6 @@ struct PCCLIOptions { char SavePath[SYS_MAX_PATH]; char GameDir[SYS_MAX_PATH]; char PlayerName[MAX_PLAYER_STRING]; - unsigned int RandomPlayerName; }; extern struct PCCLIOptions gCLIOpts; diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index 5fe5e876..04c1511b 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -301,7 +301,7 @@ static bool complete_player_name(const char* namePrefix) { return completionSuccess; } -static bool handle_tab_completion(void) { +static void handle_tab_completion(void) { bool alreadyTabCompleted = false; if (gDjuiChatBox->chatInput->buffer[0] == '/') { char* spacePosition = strrchr(sCommandsTabCompletionOriginalText, ' '); diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index 2ba1eb56..c390eada 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -299,20 +299,7 @@ void *main_game_init(void*) { if (gCLIOpts.FullScreen == 1) { configWindow.fullscreen = true; } else if (gCLIOpts.FullScreen == 2) { configWindow.fullscreen = false; } - if (gCLIOpts.RandomPlayerName == 1) { - struct timespec TS; - clock_gettime(CLOCK_MONOTONIC, &TS); - srand((unsigned int)(TS.tv_nsec ^ TS.tv_sec ^ getpid())); - - char randomDigits[9]; - for (int i = 0; i < 8; i++) { - randomDigits[i] = '0' + (rand() % 10); - } - randomDigits[8] = '\0'; - - snprintf(configPlayerName, MAX_PLAYER_STRING, "Player%s", randomDigits); - printf("\nRandom Playername (Start-Parameter): %s\n\n", configPlayerName); - } else if (gCLIOpts.PlayerName[0] != '\0') { + if (gCLIOpts.PlayerName[0] != '\0') { snprintf(configPlayerName, MAX_PLAYER_STRING, "%s", gCLIOpts.PlayerName); printf("\nCustom Playername (Start-Parameter): %s\n\n", configPlayerName); }