From eb90648bdad1443c9cfc72e903a93642e10a0ab7 Mon Sep 17 00:00:00 2001 From: scratko Date: Fri, 16 Aug 2024 18:10:11 +0300 Subject: Global fixes v2.0 Added spectator mode. Added screen of game result. Added definition of durak. If not all players can replenish their decks, they take cards one at a time in turn. --- client/data_decryption.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'client/data_decryption.c') diff --git a/client/data_decryption.c b/client/data_decryption.c index b445454..1054c45 100644 --- a/client/data_decryption.c +++ b/client/data_decryption.c @@ -126,14 +126,15 @@ void decrypt_set_position_whose_turn(struct client *cl, char *start_p, cl->position_whose_turn = decrypt_get_number(start_p, end_p); } -void decrypt_set_card_queue(struct client *cl, char *start_p) +void decrypt_set_card_queue(struct client *cl, char *start_p, char **end_p) { int i, j; - for(i = 0, j = 0; *start_p != '\n'; ++start_p) { + for(i = 0, j = 0; *start_p != ':' && *start_p != '\n'; ++start_p) { /* empty queue */ if(*start_p == '=') { i = -1; + ++start_p; break; } /* delimiter '\' */ @@ -150,6 +151,7 @@ void decrypt_set_card_queue(struct client *cl, char *start_p) if(i != -1) cl->cq.card_arr[i][j] = '\0'; cl->cq.card_arr_idx = i; + *end_p = start_p; } void decrypt_set_card_acceptance_status(struct client *cl, char *start_p) @@ -167,3 +169,13 @@ void decrypt_set_card_acceptance_status(struct client *cl, char *start_p) if(!strcmp(tmp_buffer, "not all")) cl->all_input_cards_accepted = 0; } + +void decrypt_set_spectator_mode(struct client *cl, char *start_p) +{ + cl->sp_mode = (enum spectator_mode) decrypt_get_number(start_p, NULL); +} + +void decrypt_set_durak_position(struct client *cl, char *start_p) +{ + cl->durak_position = decrypt_get_number(start_p, NULL); +} -- cgit v1.2.3