-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathways_management.c
94 lines (83 loc) · 1.97 KB
/
ways_management.c
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ways_management.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgonor <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/07/23 19:57:21 by dgonor #+# #+# */
/* Updated: 2018/07/23 19:57:23 by dgonor ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_lem.h"
void lstback_link_queue(t_link **lst, t_link *add)
{
t_link *tmp;
tmp = NULL;
if (lst && add)
{
tmp = *lst;
while (tmp->next != NULL)
{
tmp = tmp->next;
}
tmp->next = add;
}
}
void lstback_way(t_way **lst, t_way *add)
{
t_way *tmp;
tmp = NULL;
if (*lst == NULL)
*lst = add;
else if (lst && add)
{
tmp = *lst;
while (tmp->next != NULL)
{
tmp = tmp->next;
}
tmp->next = add;
}
}
void lstback_ways(t_ways **lst, t_ways *add)
{
t_ways *tmp;
tmp = NULL;
if (*lst == NULL)
*lst = add;
else if (lst && add)
{
tmp = *lst;
while (tmp->next != NULL)
{
tmp = tmp->next;
}
tmp->next = add;
}
}
t_link *create_queue(t_game *data, int queue)
{
t_link *new;
if (!(new = (t_link*)malloc(sizeof(t_link) * 1)))
{
data->error = 3;
return (NULL);
}
new->next = NULL;
new->num = queue;
return (new);
}
t_way *create_way(t_game *data, int way)
{
t_way *new;
if (!(new = (t_way*)malloc(sizeof(t_way) * 1)))
{
data->error = 3;
return (NULL);
}
new->busy = false;
new->next = NULL;
new->num = way;
return (new);
}