129 |
protocol_send_array (sock_id, |
protocol_send_array (sock_id, |
130 |
is_resume ? PROTOCOL_SAY_BIDS_RESUME : |
is_resume ? PROTOCOL_SAY_BIDS_RESUME : |
131 |
PROTOCOL_ASK_BIDS, msg); |
PROTOCOL_ASK_BIDS, msg); |
132 |
|
for(i=0; msg[i]; i++) g_free(msg[i]); |
133 |
} |
} |
134 |
|
|
135 |
void |
void |
197 |
{ |
{ |
198 |
game->rules = g_malloc (sizeof (rules_t)); |
game->rules = g_malloc (sizeof (rules_t)); |
199 |
game->rules->bid = LIBMT_BID_UNDEF; |
game->rules->bid = LIBMT_BID_UNDEF; |
200 |
|
game->rules->preneur = -1; |
201 |
|
|
202 |
/* Shuffle the cards */ |
/* Shuffle the cards */ |
203 |
shuffle (game->rules); |
shuffle (game->rules); |
218 |
* - tell the cards to the players |
* - tell the cards to the players |
219 |
*/ |
*/ |
220 |
} |
} |
221 |
|
|
222 |
|
void |
223 |
|
send_info_chien (int sock_id, player_t * p) |
224 |
|
{ |
225 |
|
game_t *g = p->game; |
226 |
|
char **msg; |
227 |
|
int i; |
228 |
|
int nb_cards_in_chien = (g->nb_players_max==5)?3:6; |
229 |
|
msg = g_malloc (sizeof (char *) * (nb_cards_in_chien+2)); |
230 |
|
msg[0] = g_strdup_printf ("%d", nb_cards_in_chien); |
231 |
|
for(i=0; i<nb_cards_in_chien; i++) g_strdup_printf("%d", g->rules->chien[i]); |
232 |
|
msg[nb_cards_in_chien + 1] = NULL; |
233 |
|
protocol_send_array (sock_id, |
234 |
|
PROTOCOL_INFO_CHIEN, msg); |
235 |
|
for(i=0; msg[i]; i++) g_free(msg[i]); |
236 |
|
} |
237 |
|
|
238 |
|
void |
239 |
|
send_ask_chien (int sock_id, player_t * p) |
240 |
|
{ |
241 |
|
char **msg; |
242 |
|
msg = g_malloc (sizeof (char *) * (1)); |
243 |
|
msg[0] = NULL; |
244 |
|
protocol_send_array (sock_id, |
245 |
|
PROTOCOL_ASK_CHIEN, msg); |
246 |
|
g_free(msg[0]); |
247 |
|
} |