Browse Source

Appel à « display_usermove_pawn » sans gérer « next_move ». Voir ligne 746.

master
Bastien 8 years ago
committed by Squiz
parent
commit
5a23177cae
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      main.c

+ 11
- 5
main.c View File

@ -383,7 +383,7 @@ enum validation_movement_t valid_move(const int start_pos_first_move, const stru
size_t j, pawn[10];
ssize_t dest, dest2;
#ifdef debug
fprintf(stderr, "=== validation de %d → %d===\n", move.start_pos, move.end_pos);
fprintf(stderr, "=== validation de %d → %d ===\n", move.start_pos, move.end_pos);
#endif
/* si c'est le dernier mouvement et le premier, on vérifie que le joueur est bloqué */
@ -547,9 +547,9 @@ void save(const char *filename, const struct player_t *player_state, const int n
fprintf(file, "=== %s (%d partie%s - %d joueurs) ===\n", buffer, nb_game, (nb_game>1)?"s":"", nb_player);
for(i=0; i < nb_game_end ; i++) {
if(duration[i] > 3600)
fprintf(file, "partie %d (%ld heure%s %ld minute%s %ld seconde%s) : ", i+1, (long int)(duration[i]/3600), ((duration[i]/3600)>1?"s":""), (long int)((duration[i]%3600)/60), ((((duration[i]%3600)/60)>1)?"s":""), (long int)((duration[i]%3600)%60), (((duration[i]%3600)%60)>1?"s":""));
fprintf(file, "partie %d (%ld heure%s, %ld minute%s et %ld seconde%s) : ", i+1, (long int)(duration[i]/3600), ((duration[i]/3600)>1?"s":""), (long int)((duration[i]%3600)/60), ((((duration[i]%3600)/60)>1)?"s":""), (long int)((duration[i]%3600)%60), (((duration[i]%3600)%60)>1?"s":""));
else if(duration[i] > 60)
fprintf(file, "partie %d (%ld minute%s %ld seconde%s) : ", i+1, (long int)(duration[i]/60), (((duration[i]/60)>1)?"s":""), (long int)(duration[i]%60), ((duration[i]%60)>1?"s":""));
fprintf(file, "partie %d (%ld minute%s et %ld seconde%s) : ", i+1, (long int)(duration[i]/60), (((duration[i]/60)>1)?"s":""), (long int)(duration[i]%60), ((duration[i]%60)>1?"s":""));
else
fprintf(file, "partie %d (%ld second%s) : ", i+1, (long int)(duration[i]), ((duration[i]%60)>1?"s":""));
if(winner[i] >= 0 && winner[i] < nb_player)
@ -737,8 +737,14 @@ int main(int argc, char **argv) {
movement.start_pos=-1; movement.end_pos=-1;
start_pos_first_move = -1;
game_state_ia_copy = game_state_copy;
/* on suppose qu'on a une stratégie */
ia_call_function(player_state[i], ia_next_move, &next_move, &game_state_ia_copy, first_move, &movement);
/* si on a une stratégie */
if(player_state[i].ia_lib_p)
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 = 1; /* on doit mettre un 0 si on ne bouge pas ou à la fin d'une série de coup */
}
printf("(GUI) Moving pawn %d → hole %d\n", movement.start_pos, movement.end_pos);
if(first_move)
start_pos_first_move = movement.start_pos; /* on retient le point de départ pour éviter les coups qui reviendraient là où on est parti */


Loading…
Cancel
Save