Adjustments to 'ChatUpdate-v3'

This commit is contained in:
David Joslin 2023-11-04 21:10:14 -07:00 committed by Agent X
parent 32b54fac9b
commit aa7859c9a0
5 changed files with 2 additions and 21 deletions

View file

@ -1 +0,0 @@

View file

@ -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();

View file

@ -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;

View file

@ -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, ' ');

View file

@ -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);
}