Browse Source

Affichage du nom des joueurs

master
Bastien 8 years ago
committed by Squiz
parent
commit
2e78937caf
1 changed files with 9 additions and 9 deletions
  1. +9
    -9
      main.c

+ 9
- 9
main.c View File

@ -271,13 +271,13 @@ int main(int argc, char **argv) {
/* rafraîchissement du plateau à l'écran */
printf("(GUI) Rendering board, branch %d\n", player_state[0].branch);
display_render_board(&gui_res, &game_state, player_state[0].branch);
display_render_board(&gui_res, &game_state, player_state[0].branch, player_state[0].name);
SDL_Flip(gui_res.screen);
if( (buffer = (char*) malloc( (23+number_length(nb_game_end+1)+number_length(nb_game)) *sizeof(char) ) ) == NULL)
display_animsg(&gui_res, &game_state, player_state[0].branch, "Début de la manche", 2000);
display_animsg(&gui_res, &game_state, player_state[0].branch, player_state[0].name, "Début de la manche", 2000);
else {
snprintf(buffer, 22+number_length(nb_game_end+1)+number_length(nb_game), "Début de la manche %d/%d", nb_game_end+1, nb_game);
display_animsg(&gui_res, &game_state, player_state[0].branch, buffer, 2000);
display_animsg(&gui_res, &game_state, player_state[0].branch, player_state[0].name, buffer, 2000);
free(buffer);
}
@ -301,7 +301,7 @@ int main(int argc, char **argv) {
ia_call_function(player_state[i], ia_next_move, &next_move, &game_state_ia_copy, first_move, &movement);
else
/* on a un joueur réel */
quit += display_usermove_pawn(&gui_res, &game_state_ia_copy, player_state[i].branch, &movement, &next_move);
quit += display_usermove_pawn(&gui_res, &game_state_ia_copy, player_state[i].branch, player_state[i].name, &movement, &next_move);
if(!quit) {
printf("(GUI) Moving pawn %d → hole %d\n", movement.start_pos, movement.end_pos);
if(first_move)
@ -318,17 +318,17 @@ int main(int argc, char **argv) {
#endif
/* on effectue le mouvement à l'écran */
if(validation_movement != jump_valid && movement.start_pos != movement.end_pos && movement.start_pos >= 0 && movement.end_pos >= 0 && movement.start_pos < 121 && movement.end_pos < 121 && player_state[i].ia_lib_p)
quit += display_animove_pawn(&gui_res, game_state_copy, player_state[i].branch, movement.start_pos, movement.end_pos);
quit += display_animove_pawn(&gui_res, game_state_copy, player_state[i].branch, player_state[i].name, movement.start_pos, movement.end_pos);
/* on regarde le résultat de la validation */
if(validation_movement == invalid) {
#ifdef debug
fprintf(stderr, "mouvement (%d,%d) invalide\n",movement.start_pos, movement.end_pos);
#endif
if( (buffer = (char*) malloc( 28 *sizeof(char) ) ) == NULL)
display_animsg(&gui_res, &game_state, player_state[i].branch, "Coup non valide", 1000);
display_animsg(&gui_res, &game_state, player_state[i].branch, player_state[i].name, "Coup non valide", 1000);
else {
snprintf(buffer, 28, "Coup non valide (%d erreur%s)", player_state[i].error+1, (player_state[i].error+1>1)?"s":"");
display_animsg(&gui_res, &game_state, player_state[i].branch, buffer, 1500);
display_animsg(&gui_res, &game_state, player_state[i].branch, player_state[i].name, buffer, 1500);
free(buffer);
}
if(++(player_state[i].error)==3) {
@ -381,11 +381,11 @@ int main(int argc, char **argv) {
/* le joueur a joué, rotation du plateau à l'écran vers le suivant */
if( (nb_player_end < nb_player-1) && !quit) { // TODO condition identique au while, c'est pour quand on arrive à la fin de la partie, ne pas tourner le plateau
printf("(GUI) Rotating board, branch %d → %d\n", player_state[j].branch, player_state[i].branch);
quit += display_anirotate_board(&gui_res, &game_state, player_state[j].branch, player_state[i].branch + (j+1!=i)*6 /*places des joueurs actuel et suivant, ∈[1-6]*/);
quit += display_anirotate_board(&gui_res, &game_state, player_state[j].branch, player_state[j].name, player_state[i].branch + (j+1!=i)*6 /*places des joueurs actuel et suivant, ∈[1-6]*/, player_state[i].name);
}
}
puts("fin de la partie");
display_animsg(&gui_res, &game_state, player_state[i].branch, "Manche terminée", 2000);
display_animsg(&gui_res, &game_state, player_state[i].branch, player_state[i].name, "Manche terminée", 2000);
/* pour les joueurs qui n'ont pas perdu */
for (i=0; i < nb_player ; i++)
if( player_state[i].error < 3 && player_state[i].ia_lib_p )


Loading…
Cancel
Save