back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/client/data_decryption.c
diff options
context:
space:
mode:
authorscratko <m@scratko.xyz>2024-08-14 02:35:56 +0300
committerscratko <m@scratko.xyz>2024-08-14 02:35:56 +0300
commit880b8be2c28d761505b2eecc1386919d5add6f2f (patch)
tree63e965c3f82bcd09bb07baf9b669a736293dddc7 /client/data_decryption.c
parenta2d696dea797faaa3157046c8ae89cd70e965bff (diff)
downloaddurak-880b8be2c28d761505b2eecc1386919d5add6f2f.tar.gz
durak-880b8be2c28d761505b2eecc1386919d5add6f2f.tar.bz2
durak-880b8be2c28d761505b2eecc1386919d5add6f2f.zip
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.
Diffstat (limited to 'client/data_decryption.c')
-rw-r--r--client/data_decryption.c12
1 files changed, 6 insertions, 6 deletions
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 <stdlib.h>
#include <string.h>
+#include <unistd.h>
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;
}