aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_map_dims.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-04 00:17:54 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-04 00:17:54 +0100
commit46ed1046b3d8e9dfbb9438552582898c3c79a9f5 (patch)
treefd1d0c451944d55945375cceeda800ac6664cf27 /src/ft_get_map_dims.c
parentMap update (diff)
download42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.tar.gz
42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.tar.bz2
42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.tar.xz
42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.tar.zst
42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.zip
Chelou maps work, now sides check
Diffstat (limited to 'src/ft_get_map_dims.c')
-rw-r--r--src/ft_get_map_dims.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/ft_get_map_dims.c b/src/ft_get_map_dims.c
new file mode 100644
index 0000000..a26a891
--- /dev/null
+++ b/src/ft_get_map_dims.c
@@ -0,0 +1,48 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_get_map_dims.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:28:47 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:28:47 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <libft.h>
+#include <cub3d.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdint.h>
+
+size_t
+ ft_get_map_h(char **map)
+{
+ size_t i;
+
+ i = 0;
+ while (map[i])
+ i++;
+ return (i);
+}
+
+size_t
+ ft_get_map_w(char **map)
+{
+ size_t i;
+ size_t big;
+ size_t tmp;
+
+ i = 0;
+ big = 0;
+ tmp = 0;
+ while (map[i])
+ {
+ tmp = ft_strlen(map[i]);
+ if (tmp > big)
+ big = tmp;
+ i++;
+ }
+ return (big);
+}