-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint_adjacent_list.c
More file actions
59 lines (53 loc) · 1.9 KB
/
print_adjacent_list.c
File metadata and controls
59 lines (53 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_adjacent_list.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbeaufre <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/06/17 16:32:05 by rbeaufre #+# #+# */
/* Updated: 2019/11/25 21:46:19 by rbeaufre ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
static void ft_print_node_2(t_node *node)
{
t_list *tmp2;
t_node *node2;
tmp2 = node->next;
if (tmp2 == NULL)
ft_printf(" nothing!");
while (tmp2 != NULL)
{
node2 = ((t_node *)tmp2->content);
ft_printf("{YELLOW}%s{EOC} (arcw : %i)", node2->name, tmp2->arcw);
if (tmp2->next)
ft_printf(", ");
tmp2 = tmp2->next;
}
}
void ft_print_node(t_node *node)
{
ft_printf("{YELLOW}Room %-5s{EOC} - Id:%-2i", node->name, node->id);
ft_printf("Hash: %i -", node->name_hash);
ft_printf("Passed flag : %i - ", node->passed_flag);
ft_printf("Position %2i:%-2i linked with: ", node->x_coord, node->y_coord);
ft_print_node_2(node);
if (node->is_start == 1)
ft_printf("\n{GREEN}[START]{EOC}");
if (node->is_end == 1)
ft_printf("\n{RED}[END]{EOC}");
ft_printf("\n-----------------------\n");
}
void ft_print_adjacent_list(t_list **list)
{
t_list *tmp;
t_node *node;
tmp = *list;
while (tmp != NULL && tmp->content != NULL)
{
node = ((t_node *)tmp->content);
ft_print_node(node);
tmp = tmp->next;
}
}