Exemple #1
0
int				sf_save_link(t_room *room, char *room_name, char *link_name)
{
	while (ft_strcmp(room_name, room->name))
		room = room->next;
	if (ft_is_str_a_link(link_name, room->tmp_link))
		return (-1);
	while (room->link != NULL)
	{
		if (room->link->next == NULL)
		{
			if (!(room->link->next = ft_new_link()))
				return (-5);
			room->link = room->link->next;
			break ;
		}
		room->link = room->link->next;
	}
	if (room->link == NULL)
	{
		room->link = ft_new_link();
		room->tmp_link = room->link;
	}
	room->link->name = ft_strdup(link_name);
	return (0);
}
int		ft_make_link_graphs(char **infos, t_lem **graph)
{
	int		i;

	i = 0;
	while ((infos[i] != '\0'))
	{
		if (infos[i][0] == '#' && infos[i][1] != '#')
			i++;
		if (ft_is_char(infos[i], '-') == 0)
			return (0);
		else
		{
			if (ft_new_link(infos[i], graph) == 0)
				return (0);
		}
		i++;
	}
}