back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/client/client.c
diff options
context:
space:
mode:
authorscratko <m@scratko.xyz>2024-08-16 18:10:11 +0300
committerscratko <m@scratko.xyz>2024-08-16 18:10:11 +0300
commiteb90648bdad1443c9cfc72e903a93642e10a0ab7 (patch)
treedc567a9aa834bb0d5f3429e8a38910990d75e4eb /client/client.c
parent880b8be2c28d761505b2eecc1386919d5add6f2f (diff)
downloaddurak-eb90648bdad1443c9cfc72e903a93642e10a0ab7.tar.gz
durak-eb90648bdad1443c9cfc72e903a93642e10a0ab7.tar.bz2
durak-eb90648bdad1443c9cfc72e903a93642e10a0ab7.zip
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.
Diffstat (limited to 'client/client.c')
-rw-r--r--client/client.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/client/client.c b/client/client.c
index 4abcf7d..a5b3daf 100644
--- a/client/client.c
+++ b/client/client.c
@@ -54,13 +54,19 @@ static void get_data_from_server(struct client *cl, fd_set *readfds)
decrypt_set_position_whose_turn(cl, end_p+1, &end_p);
break;
case defense_expectation:
+ case spectator:
decrypt_set_base_info(cl, end_p+1, &end_p);
decrypt_set_position_whose_turn(cl, end_p+1, &end_p);
- decrypt_set_card_queue(cl, end_p+1);
+ decrypt_set_card_queue(cl, end_p+1, &end_p);
+ if(cl->state == spectator)
+ decrypt_set_spectator_mode(cl, end_p+1);
break;
case card_acceptance_status:
decrypt_set_card_acceptance_status(cl, end_p+1);
break;
+ case result:
+ decrypt_set_durak_position(cl, end_p+1);
+ break;
/* no data to extract */
case tossing_limit_status:
default:
@@ -102,6 +108,7 @@ static void prepare_tips_for_client(struct client *cl)
static void change_client_frame(struct client *cl)
{
if(cl->display_new_frame) {
+ pgf_new_frame();
switch(cl->state) {
case first_player:
pgf_first_player();
@@ -121,6 +128,10 @@ static void change_client_frame(struct client *cl)
pgf_select_idle_mode_message(cl->state);
}
break;
+ case spectator:
+ pgf_table(cl);
+ pgf_spectator_mode(cl->sp_mode);
+ break;
case attack:
case defense:
case tossing:
@@ -133,7 +144,10 @@ static void change_client_frame(struct client *cl)
case tossing_limit_status:
pgf_tossing_limit_status();
break;
- default:
+ case result:
+ pgf_game_result(cl->durak_position);
+ break;
+ case none:
{}
}
cl->display_new_frame = 0;
@@ -229,6 +243,8 @@ static void init_client(struct client *cl)
cl->display_new_frame = 0;
cl->all_input_cards_accepted = 0;
cl->data_left_in_buffer = 0;
+ cl->sp_mode = spectator_table;
+ cl->durak_position = 0;
}
/*