-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_process.c
45 lines (40 loc) · 1.33 KB
/
create_process.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* create_process.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ydeineha <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/09/05 21:28:10 by ydeineha #+# #+# */
/* Updated: 2018/09/05 21:28:14 by ydeineha ### ########.fr */
/* */
/* ************************************************************************** */
#include "corewar.h"
t_process *create_process(t_player *player)
{
int i;
t_process *proc;
t_process *tmp;
i = 0;
proc = NULL;
tmp = NULL;
while (i < g_game.players)
{
tmp = new_process(&player[i], NULL, player[i].start);
tmp->col = -1;
add_process(&proc, tmp);
i++;
}
return (proc);
}
void add_process(t_process **head, t_process *new)
{
t_process *tmp;
tmp = NULL;
if (head && new)
{
tmp = *head;
new->next = tmp;
*head = new;
}
}