Example #1
0
void	display(char *map)
{
  int	start;
  int	nb_ply;
  int	nb_team;
  char	team_win;

  start = 0;
  while (42)
    {
      if ((nb_team = count_team(map)) == 1)
	team_win = get_last_team(map);
      nb_ply = count_player(map, 'a');
      start = (nb_ply >= NB_PLAY ? 1 : start);
      if (nb_ply < NB_PLAY && start == 0)
	wrt_str("-{ You have to put more player for start the game. }-\n");
      else
	wrt_str("-{ The Game is running ! }-\n");
      display_stat(map, nb_ply, nb_team);
      display_map(map);
      if (nb_ply == 1 && start == 1)
	{
	  printf("The team %d Win !!!!\n", team_win - '0');
	  break;
	}
    }
}
Example #2
0
int		init_team(t_serv *serveur, char **argv)
{
  if ((serveur->nb_team = count_team(argv)) >= 2)
    {
      get_teamname(serveur, argv);
      check_teamname(serveur);
      create_drones(serveur);
      serveur->nb_eggs = 0;
      serveur->max_eggs = 0;
      serveur->egg = xmalloc(sizeof(*serveur->egg));
    }
  else if (serveur->nb_team == 1)
    {
      fprintf(stderr, ERRNBTEAM);
      exit(EXIT_FAILURE);
    }
  else if (serveur->nb_team == 0)
    return (-1);
  return (0);
}