|
|
@ -5,6 +5,9 @@ |
|
|
|
#include <time.h> |
|
|
|
#include "api.h" |
|
|
|
|
|
|
|
#include <SDL/SDL.h> |
|
|
|
#include "gui.h" |
|
|
|
|
|
|
|
#define start_pos startPos |
|
|
|
#define end_pos endPos |
|
|
|
|
|
|
@ -308,12 +311,14 @@ int main(int argc, char** argv) { |
|
|
|
puts(""); |
|
|
|
#endif |
|
|
|
|
|
|
|
/* ouverture de la fenêtre graphique */ |
|
|
|
struct gui_resource_t gui_res = display_start(gui_res); |
|
|
|
|
|
|
|
/* appel de start_match */ |
|
|
|
for( i=0 ; i < nb_player ; i++ ) |
|
|
|
if( player_state[i].ia_lib_p ) |
|
|
|
ia_call_function(player_state[i], ia_start_match, NULL, nb_player, i+1); |
|
|
|
|
|
|
|
|
|
|
|
while( nb_game-- > 0 ) { |
|
|
|
#ifdef debug |
|
|
|
fprintf(stderr,"%d %s left\n", nb_game, nb_game>1?"games":"game"); |
|
|
@ -335,6 +340,10 @@ int main(int argc, char** argv) { |
|
|
|
game_state.board[start_position[player_state[i].branch][j]] = (player_state[i].branch)+1; |
|
|
|
} |
|
|
|
|
|
|
|
/* rafraîchissement du plateau à l'écran */ |
|
|
|
display_render_board(gui_res, game_state); |
|
|
|
SDL_Flip(gui_res.screen); |
|
|
|
|
|
|
|
#ifdef debug |
|
|
|
for(i=0;i<121; i++) |
|
|
|
if(game_state.board[i]) |
|
|
@ -378,6 +387,9 @@ int main(int argc, char** argv) { |
|
|
|
ia_call_function(player_state[i], ia_end_game, NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
/* le joueur a déplacé un pion, rafraîchissement du plateau à l'écran */ |
|
|
|
display_render_board(gui_res, game_state); |
|
|
|
SDL_Flip(gui_res.screen); |
|
|
|
} else { |
|
|
|
#ifdef debug |
|
|
|
fprintf(stderr, "mouvement (%d,%d) invalide\n",movement.start_pos, movement.end_pos); |
|
|
@ -412,7 +424,8 @@ int main(int argc, char** argv) { |
|
|
|
dlclose(player_state[i].ia_lib_p); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* fermeture de la fenêtre graphique */ |
|
|
|
display_close(gui_res); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |