|
|
@ -75,10 +75,10 @@ int main(int argc, char** argv) { |
|
|
|
} else { |
|
|
|
/* on initialise la bibliothèque */ |
|
|
|
char* error; |
|
|
|
void (*library_init) (); |
|
|
|
*(void **) (&library_init) = dlsym(player_branch[i].lib_strategy_p, "InitLibrary"); |
|
|
|
void (*library_init_pf)(); |
|
|
|
*(void **) (&library_init_pf) = dlsym(player_branch[i].lib_strategy_p, "InitLibrary"); |
|
|
|
if((error=dlerror()) == NULL) { |
|
|
|
(*library_init)("toto"); // TODO : passer le nom de la stratégie en paramètre |
|
|
|
(*library_init_pf)("toto"); // TODO : passer le nom de la stratégie en paramètre |
|
|
|
} |
|
|
|
#ifdef debug |
|
|
|
else |
|
|
@ -101,9 +101,37 @@ int main(int argc, char** argv) { |
|
|
|
#endif |
|
|
|
|
|
|
|
/* on démarre le jeu */ |
|
|
|
for(i=0 ; i < nb_player ; i++) { |
|
|
|
if(player_branch[i].lib_strategy_p != NULL) { |
|
|
|
char* error; |
|
|
|
void (*library_start_match_pf)(const unsigned int, const enum player_t); |
|
|
|
*(void **) (&library_start_match_pf) = dlsym(player_branch[i].lib_strategy_p, "StartMatch"); |
|
|
|
if((error=dlerror()) == NULL) { |
|
|
|
(*library_start_match_pf)(nb_player, i+1); |
|
|
|
} |
|
|
|
#ifdef debug |
|
|
|
else |
|
|
|
fprintf(stderr,"function StartMatch not found in stratégie (%d)\n", i); |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* fin du jeu */ |
|
|
|
for(i=0 ; i < nb_player ; i++) { |
|
|
|
if(player_branch[i].lib_strategy_p != NULL) { |
|
|
|
char* error; |
|
|
|
void (*library_end_match_pf)(); |
|
|
|
*(void **) (&library_end_match_pf) = dlsym(player_branch[i].lib_strategy_p, "EndMatch"); |
|
|
|
if((error=dlerror()) == NULL) { |
|
|
|
(*library_end_match_pf)(); |
|
|
|
} |
|
|
|
#ifdef debug |
|
|
|
else |
|
|
|
fprintf(stderr,"function EndMatch not found in stratégie (%d)\n", i); |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* on décharge toutes les stratégies */ |
|
|
|