Example #1
0
int			check_spot_champ(t_list *list, t_game *game)
{
  t_list		*tmp;
  int			i;
  int			tab_spot[5];

  i = 0;
  while (i < 5)
    {
      tab_spot[i] = -2;
      i = i + 1;
    }
  i = 0;
  tmp = list;
  while (tmp)
    {
      tab_spot[i] = tmp->champ->spot_champ;
      tmp = tmp->prev;
      i = i + 1;
    }
  if ((check_spot(tab_spot)) == ERROR)
    return (my_perror(ERR_SPOT));
  if ((must_init_spot(tab_spot)) == GOOD)
    modif_spot(list, tab_spot, game);
  return (GOOD);
}
Example #2
0
File: parser.c Project: fave-r/RT
void		fill_list(char **tmp, t_flag tab[], t_obj *obj, t_spot *spot)
{
  static int	i = 0;

  i++;
  if (is_in_tab(tmp[0], tab) == 1)
    {
      check_obj(tmp, i);
      new_obj(tmp, obj);
    }
  else if (my_strcompare("SPOT", tmp[0]))
    {
      check_spot(tmp, i);
      new_spot(tmp, spot);
    }
  else
    {
      fprintf(stderr, "Unknown object line %d\n", i);
      exit(EXIT_FAILURE);
    }
}
Example #3
0
int		*place_token(t_filler *fil)
{
	int i;
	int j;

	i = 0;
	fil->min = INT_MAX;
	while (i <= fil->map_h - fil->token_h)
	{
		j = 0;
		while (j <= fil->map_w - fil->token_w)
		{
			if (check_spot(fil, i, j) && count_points(fil, i, j))
			{
				fil->i = i;
				fil->j = j;
			}
			j++;
		}
		i++;
	}
	return (0);
}