-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlight.c
51 lines (45 loc) · 1.45 KB
/
light.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* light.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sboeuf <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/02/16 19:20:42 by sboeuf #+# #+# */
/* Updated: 2014/02/16 19:22:49 by sboeuf ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/rtv1.h"
t_light *new_light(t_vect *p, t_color *c)
{
t_light *l;
l = (t_light*)malloc(sizeof(t_light));
l->position = p;
l->c = c;
l->next = NULL;
return (l);
}
void add_light(t_light *start, t_light *new)
{
if (start == NULL)
start = new;
else
{
while (start->next != NULL)
start = start->next;
start->next = new;
}
}
void delete_lights(t_light **start)
{
t_light *tmp;
while (*start != NULL)
{
tmp = (*start)->next;
delete_vect((*start)->position);
delete_color((*start)->c);
(*start)->next = NULL;
free(*start);
*start = tmp;
}
}