From 9970a2275a56d7835ba0c12a8586dc25cf7ec1cf Mon Sep 17 00:00:00 2001 From: scratko Date: Sun, 18 Aug 2024 01:33:08 +0300 Subject: Global fixes v4.0 Removed unnecessary comments. Added resource cleanup for client and server. Changed queue display. Added player indicator. It's possible to quit the game while typing or waiting for a connection. Fixed a bug with determining the limit of card tossing. --- client/verification_client_input.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'client/verification_client_input.c') diff --git a/client/verification_client_input.c b/client/verification_client_input.c index 171cd64..fa88b54 100644 --- a/client/verification_client_input.c +++ b/client/verification_client_input.c @@ -39,6 +39,7 @@ int vci_attack_or_tossing(int fd, char *buffer, player_cards deck, if(state == tossing && buffer[0] == '\n') { /* cancel card tossing */ write(fd, buffer, 1); + printf("skipping the card toss\n"); return 1; } @@ -72,9 +73,9 @@ int vci_attack_or_tossing(int fd, char *buffer, player_cards deck, ++free_pos; } if(state == attack && buffer[0] == '\n') { - printf("incorrect input\n> "); - fflush(stdout); - return 0; + printf("incorrect input\n> "); + fflush(stdout); + return 0; } output_buffer[free_pos] = '\n'; write(fd, output_buffer, free_pos+1); @@ -92,6 +93,7 @@ int vci_defense(int fd, char *buffer, player_cards deck) if(buffer[0] == '\n') { /* the player does not want to keep the defense */ write(fd, buffer, 1); + printf("accepting cards\n"); return 1; } if(buffer[1] != '\n') { @@ -107,5 +109,7 @@ int vci_defense(int fd, char *buffer, player_cards deck) return 1; } /* card is not found in the deck or cannot be used */ + printf("incorrect input\n> "); + fflush(stdout); return 0; } -- cgit v1.2.3