back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/client/client.c
diff options
context:
space:
mode:
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;
}
/*