Exemplo n.º 1
0
void				omg(t_list *list, int value, int ant)
{
	t_list		*link;
	t_salle		*path;
	t_list		*start;

	value = 1;
	link = list;
	start = list;
	is_possible(list);
	if (preliminary_check(list) == 1)
		fast_end(list, ant);
	while (((t_salle *)link->content)->status != END)
		link = link->next;
	path = CNT;
	while (path_avaiable(link) >= 1)
	{
		while (path && path->status != START)
			path = is_path(path, value);
		reinit_dist(start);
		give_value((t_salle*)start->content);
		((t_salle *)list->content)->dist = 0;
		value++;
		path = ((t_salle *)link->content);
	}
	print(list, how_many_valid(list), ant);
}
Exemplo n.º 2
0
static int long_activate(const char* arg, int eq, struct option* opt)
{
    int r=0;
    opt->active=1;
    if (eq)
    {
        if (opt->takes_value)
        {
            r = give_value(arg+eq, opt);
        }
    }
    return r;
}
Exemplo n.º 3
0
void			resolve(t_list *list, int ant)
{
	int			value;
	t_list		*l;

	l = list;
	value = 1;
	init_dist(list);
	valid_start(list);
	((t_salle*)list->content)->dist = 0;
	give_value((t_salle*)list->content);
	while (l != NULL)
	{
		if (((t_salle *)l->content)->name[0] == 'L')
			ft_error();
		l = l->next;
	}
	if (ant <= 0)
		ft_error();
	omg(list, value, ant);
}
Exemplo n.º 4
0
void			give_value(t_salle *salle)
{
	t_list		*link;
	t_salle		*test;
	t_list		*temp_link;

	link = salle->link;
	temp_link = link;
	while (link != NULL)
	{
		test = (t_salle *)link->content;
		if ((test->dist > salle->dist + 1 || test->dist == -1)
				&& test->way_value == 0)
		{
			test->dist = salle->dist + 1;
			if (test->status != END)
				give_value(test);
		}
		link = link->next;
	}
}
Exemplo n.º 5
0
static int short_activate(const char* next, struct option* opt)
{
    int r=0;
    opt->active=1;
    if (next)
    {
        if (opt->takes_value)
        {
            if (next[0] != '-' && next[0])
                r=1;
            else if (!next[1])
                r=1;
            if (r)
                if (give_value(next, opt))
                    r=-1;
        }
    }
    else
        r=1;
    return r;
}