main.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* $Id: main.c,v 1.11 2001/05/02 11:04:27 kilobug Exp $ */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <sys/types.h>
  5. #include <signal.h>
  6. #include <server.h>
  7. #include <network.h>
  8. #include <conf.h>
  9. #include <plugins.h>
  10. #ifdef ENABLE_GPC
  11. void init_Gpc(int argc, char **argv, char **arge);
  12. void init_Init();
  13. #endif
  14. int main(int argc, char **argv, char **arge)
  15. {
  16. conf_t *conf = NULL;
  17. GSList *l;
  18. player_t *player;
  19. #ifdef ENABLE_GPC
  20. init_Gpc(argc, argv, arge);
  21. init_Init();
  22. #endif
  23. conf = init(argc, argv);
  24. if (conf == NULL)
  25. {
  26. abort();
  27. }
  28. launch_game(conf);
  29. for (l = conf->players ; l != NULL ; l = l->next)
  30. {
  31. gl_player = l->data;
  32. fprintf(stdout, "Player %d : %f\n", gl_player->team_id,
  33. gl_player->score);
  34. fflush(stdout);
  35. }
  36. gfx_client_new_turn(1);
  37. kill(gl_config->messager_pid, SIGUSR1);
  38. gl_config->messager_pid = 0;
  39. for (l = gl_config->players ; l != NULL ; l = l->next)
  40. {
  41. player = l->data;
  42. kill(player->pid, SIGKILL);
  43. player->pid = 0;
  44. }
  45. return 0;
  46. }