back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/client/verification_client_input.c
diff options
context:
space:
mode:
authorscratko <m@scratko.xyz>2024-08-18 01:33:08 +0300
committerscratko <m@scratko.xyz>2024-08-18 01:33:08 +0300
commit9970a2275a56d7835ba0c12a8586dc25cf7ec1cf (patch)
tree914b9353b2df1ba9dec5481fa3e7e6a8462dea5d /client/verification_client_input.c
parent4b2fdc91d42a438193d15840e10851c3847fbe80 (diff)
downloaddurak-9970a2275a56d7835ba0c12a8586dc25cf7ec1cf.tar.gz
durak-9970a2275a56d7835ba0c12a8586dc25cf7ec1cf.tar.bz2
durak-9970a2275a56d7835ba0c12a8586dc25cf7ec1cf.zip
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.
Diffstat (limited to 'client/verification_client_input.c')
-rw-r--r--client/verification_client_input.c10
1 files changed, 7 insertions, 3 deletions
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;
}