From 68140fe7c849de10ffb5b6684dccc22b93012a20 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 18 Feb 2024 19:31:07 +0100 Subject: [PATCH] made formatting so fucking pretty --- src/chat/misc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/chat/misc.c b/src/chat/misc.c index 155b04a..da9a180 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -640,7 +640,7 @@ void *why2_listen_server(void *socket) { char *read = NULL; why2_bool exiting = 0; - why2_bool asking_username = 0; + unsigned char asking_username = 0; printf(">>> "); fflush(stdout); @@ -655,7 +655,7 @@ void *why2_listen_server(void *socket) { if (strcmp(read + 8, WHY2_CHAT_CODE_SSQC) == 0) { - printf("%s%s\nServer closed the connection.\n", WHY2_CLEAR_AND_GO_UP WHY2_CLEAR_AND_GO_UP, (!asking_username ? "\n": "")); + printf("%s%s%s\nServer closed the connection.\n", asking_username == WHY2_MAX_USERNAME_TRIES ? WHY2_CLEAR_AND_GO_UP : "", WHY2_CLEAR_AND_GO_UP WHY2_CLEAR_AND_GO_UP, (asking_username == 0 ? "\n": "")); fflush(stdout); pthread_cancel(getline_thread); //CANCEL CLIENT getline @@ -668,10 +668,10 @@ void *why2_listen_server(void *socket) { username_pick: - printf("%sEnter username (a-Z, 0-9; %d-%d characters):\n", WHY2_CLEAR_AND_GO_UP, WHY2_MIN_USERNAME_LENGTH, WHY2_MAX_USERNAME_LENGTH); + printf("%s%sEnter username (a-Z, 0-9; %d-%d characters):\n", asking_username > 0 ? WHY2_CLEAR_AND_GO_UP : "", WHY2_CLEAR_AND_GO_UP, WHY2_MIN_USERNAME_LENGTH, WHY2_MAX_USERNAME_LENGTH); fflush(stdout); - asking_username = 1; + asking_username++; goto continue_input; } else if (strcmp(read + 8, WHY2_CHAT_CODE_INVALID_COMMAND) == 0) //PICK USERNAME @@ -682,7 +682,7 @@ void *why2_listen_server(void *socket) goto continue_input; } else if (strcmp(read + 8, WHY2_CHAT_CODE_INVALID_USERNAME) == 0) //PICK USERNAME { - printf("\nInvalid username!\n\n\n"); + printf(WHY2_CLEAR_AND_GO_UP WHY2_CLEAR_AND_GO_UP "%s\nInvalid username!\n\n\n", asking_username > 1 ? WHY2_CLEAR_AND_GO_UP : ""); fflush(stdout); goto username_pick;