-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.c
61 lines (56 loc) · 1.76 KB
/
init.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mlambert <mlambert@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/04/12 18:17:26 by mlambert #+# #+# */
/* Updated: 2017/04/13 21:41:05 by mlambert ### ########.fr */
/* */
/* ************************************************************************** */
#include "filler.h"
void reinit_after_play(t_core *core)
{
core->map.i = 0;
core->map.j = 0;
core->piece.i = 0;
core->piece.j = 0;
core->map.visual = NULL;
core->piece.visual = NULL;
core->opti_y = 2147483647;
core->opti_x = 2147483647;
core->radar = -1;
core->turn = 0;
}
void player_and_nmy(t_core *core, char *line)
{
if (line[10] == '1')
core->player = 'O';
else
core->player = 'X';
core->enemy = (core->player == 'O') ? 'X' : 'O';
}
void little_tweak(t_core *core)
{
core->map.i = 0;
core->map.j = 0;
core->piece.i = 0;
core->piece.j = 0;
}
void initialize(t_core *core)
{
ft_bzero(core, sizeof(t_core));
core->start = -1;
core->map.visual = NULL;
core->piece.visual = NULL;
core->map.x = -1;
core->map.y = -1;
core->radar = -1;
core->piece.x = -1;
core->piece.y = -1;
core->last_y = -1;
core->last_x = -1;
core->opti_y = 2147483647;
core->opti_x = 2147483647;
}