-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils2.c
More file actions
61 lines (54 loc) · 1.62 KB
/
Copy pathutils2.c
File metadata and controls
61 lines (54 loc) · 1.62 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
60
61
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bbento-e <bbento-e@student.42porto.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/15 15:34:20 by bbento-e #+# #+# */
/* Updated: 2023/07/03 13:50:48 by bbento-e ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void ft_print_array(t_data *data, char **array)
{
int i;
int j;
i = 0;
j = 0;
while (i <= data->y)
{
while (array && array[i][j] != '\0')
{
ft_printf("%c", array[i][j]);
j++;
}
i++;
j = 0;
ft_printf("\n");
}
}
void player_handler(t_types *types, t_data *data, int x, int y)
{
types->player++;
data->px = x;
data->py = y;
}
void wall_handler(t_types *types, t_data *data, int x, int y)
{
if (data->map[y][x] == '1')
types->wall++;
else
types->trigger = -1;
}
int next_random(unsigned int seed)
{
unsigned int multiplier;
unsigned int increment;
unsigned int modulus;
multiplier = 13515245;
increment = 12345;
modulus = 21474848;
seed = (multiplier * seed + increment) % modulus;
return ((int)seed);
}