From 880b8be2c28d761505b2eecc1386919d5add6f2f Mon Sep 17 00:00:00 2001 From: scratko Date: Wed, 14 Aug 2024 02:35:56 +0300 Subject: Global fixes v1.0 Defense hint now only takes into account unbeaten cards. The client accounts for sticky data in one packet via TCP. Changed delimiter when sending data related to cards on the table and the queue (from '0' to '='). Accepting cards from a client (verification_client_input.c) is heavily patched. Cards are taken from the stack at the hint's prompt. Added pop_stack(). The trump card is retrieved from the end of the array. Changed the check of the defender's ability to beat all cards. --- client/data_decryption.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'client/data_decryption.c') diff --git a/client/data_decryption.c b/client/data_decryption.c index 2d10561..b445454 100644 --- a/client/data_decryption.c +++ b/client/data_decryption.c @@ -4,6 +4,7 @@ #include #include +#include void decrypt_set_state(struct client *cl, char **end_p) { @@ -24,11 +25,9 @@ static void decrypt_set_trump_card(struct client *cl, char *start_p, { int i; - for(i = 0; *start_p != '\0'; ++start_p, ++i) + for(i = 0; *start_p != ':'; ++start_p, ++i) cl->trump_card[i] = *start_p; cl->trump_card[i] = '\0'; - /* move to : */ - ++start_p; *end_p = start_p; } @@ -65,7 +64,7 @@ void decrypt_set_base_info(struct client *cl, char *start_p, char **end_p) i = 0, j = 0; for(start_p = *end_p + 1; *start_p != ':'; ++start_p) { /* empty table */ - if(*start_p == '0') { + if(*start_p == '=') { /* to delimiter : */ ++start_p; i = -1; @@ -94,7 +93,7 @@ void decrypt_set_base_info(struct client *cl, char *start_p, char **end_p) for(++start_p, i = 0; *start_p != ':' && *start_p != '\n'; ++start_p) { /* empty deck */ - if(*start_p == '0') { + if(*start_p == '=') { i = -1; /* to delimiter ':' or '\n' */ ++start_p; @@ -107,6 +106,7 @@ void decrypt_set_base_info(struct client *cl, char *start_p, char **end_p) strcpy(card, tmp_card); push_stack(&cl->deck, card); i = 0; + continue; } tmp_card[i] = *start_p; ++i; @@ -132,7 +132,7 @@ void decrypt_set_card_queue(struct client *cl, char *start_p) for(i = 0, j = 0; *start_p != '\n'; ++start_p) { /* empty queue */ - if(*start_p == '0') { + if(*start_p == '=') { i = -1; break; } -- cgit v1.2.3