Exemplo n.º 1
0
t_cylinder	*get_cylinders(int fd)
{
	int			r;
	char		*line;
	t_cylinder	*c;

	c = NULL;
	while ((r = get_next_line(fd, &line)) > 0 && ft_strcmp(line, "----------"))
	{
		if (!ft_strcmp("new:", line))
		{
			if (c == NULL)
				c = get_cylinder(fd);
			else
				add_cylinder(c, get_cylinder(fd));
		}
	}
	if (r == -1)
		exit(-1);
	return (c);
}
Exemplo n.º 2
0
/*
 * Set up anything that could have changed due to editing
 * of dive information
 */
static void fill_one_dive(struct dive *dive,
			  GtkTreeModel *model,
			  GtkTreeIter *iter)
{
	char *location, *cylinder;

	get_cylinder(dive, &cylinder);
	get_location(dive, &location);

	gtk_list_store_set(GTK_LIST_STORE(model), iter,
		DIVE_NR, dive->number,
		DIVE_LOCATION, location,
		DIVE_CYLINDER, cylinder,
		DIVE_RATING, dive->rating,
		DIVE_SAC, dive->sac,
		DIVE_OTU, dive->otu,
		-1);
}
Exemplo n.º 3
0
t_vec   get_normal_vec(t_hit *hit)
{
  t_vec n;

  if (hit->obj_type == TORUS)
    n = get_torus_n(hit);
  else if (hit->obj_type == SPHERE)
    n = get_sphere(hit);
  else if (hit->obj_type == CYLINDER)
    n = get_cylinder(hit);
  else if (hit->obj_type == CONE)
    n = get_cone(hit);
  else if (hit->obj_type == PLAN)
    n = hit->meta.rot;
  if (hit->obj_type != NONE && hit->meta.perlin.ratio
      && hit->meta.perlin.type == 2)
    n = bump_vec(hit, n);
  return (n);
}
Exemplo n.º 4
0
static void fill_one_dive(struct dive *dive,
			  GtkTreeModel *model,
			  GtkTreeIter *iter)
{
	int sac;
	char *location, *cylinder;

	get_cylinder(dive, &cylinder);
	get_location(dive, &location);
	get_sac(dive, &sac);

	/*
	 * We only set the fields that changed: the strings.
	 * The core data itself is unaffected by units
	 */
	gtk_list_store_set(GTK_LIST_STORE(model), iter,
		DIVE_LOCATION, location,
		DIVE_CYLINDER, cylinder,
		DIVE_SAC, sac,
		-1);
}