aboutsummaryrefslogtreecommitdiff
path: root/src/parse
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-02-03 02:27:54 +0100
committerCharles <sircharlesaze@gmail.com>2020-02-03 02:27:54 +0100
commit0ca2404b509ef4ddc4e19996cdbe3edbbba6d339 (patch)
tree28321d75ebf590b491eb956a7481cf750f0f7d44 /src/parse
parent628f82dbb9d44dfda7ebde0a54b6559b275e204c (diff)
downloadcub3d-0ca2404b509ef4ddc4e19996cdbe3edbbba6d339.tar.gz
cub3d-0ca2404b509ef4ddc4e19996cdbe3edbbba6d339.tar.bz2
cub3d-0ca2404b509ef4ddc4e19996cdbe3edbbba6d339.zip
sprite from lodev and capture from random stackoverflow thread, now lets understand this nightmare
Diffstat (limited to 'src/parse')
-rw-r--r--src/parse/parse_check.c29
-rw-r--r--src/parse/parse_textures.c2
2 files changed, 15 insertions, 16 deletions
diff --git a/src/parse/parse_check.c b/src/parse/parse_check.c
index a65d74a..5fc2674 100644
--- a/src/parse/parse_check.c
+++ b/src/parse/parse_check.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/11 10:59:15 by cacharle #+# #+# */
-/* Updated: 2020/01/11 13:03:33 by cacharle ### ########.fr */
+/* Updated: 2020/02/02 19:42:34 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,8 +15,8 @@
t_state *parse_check(t_state *state)
{
int i;
- /* int j; */
- /* int player_count; */
+ int j;
+ int player_count;
i = -1;
while (++i < state->map_width)
@@ -30,17 +30,16 @@ t_state *parse_check(t_state *state)
|| state->map[i][state->map_width - 1] != CELL_WALL)
return (error_put_return_state_destroy(
"validate map without borders", state));
- // maybe not necessary
- /* player_count = 0; */
- /* i = -1; */
- /* while (++i < state->map_height) */
- /* { */
- /* j = -1; */
- /* while (++j < state->map_width) */
- /* if (helper_is_player_cell(state->map[i][j])) */
- /* player_count++; */
- /* } */
- /* if (player_count != 1) */
- /* return (state_destroy(state)); */
+ player_count = 0;
+ i = -1;
+ while (++i < state->map_height)
+ {
+ j = -1;
+ while (++j < state->map_width)
+ if (helper_is_player_cell(state->map[i][j]))
+ player_count++;
+ }
+ if (player_count != 1)
+ return (error_put_return_state_destroy("only one player allowed", state));
return (state);
}
diff --git a/src/parse/parse_textures.c b/src/parse/parse_textures.c
index a0fb8f6..f6ba1a0 100644
--- a/src/parse/parse_textures.c
+++ b/src/parse/parse_textures.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/11 09:47:53 by cacharle #+# #+# */
-/* Updated: 2020/01/11 09:51:03 by cacharle ### ########.fr */
+/* Updated: 2020/02/02 19:21:39 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */