main.c 929 B

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