From b4825e7b78daf4953adfeba37fc48dba801f7d57 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 13 Feb 2020 23:35:05 +0100 Subject: Nice changes, secured segvs --- src/ft_detect.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ft_detect.c') diff --git a/src/ft_detect.c b/src/ft_detect.c index 3dafd67..e91ca50 100644 --- a/src/ft_detect.c +++ b/src/ft_detect.c @@ -1,3 +1,4 @@ +#include #include #include @@ -61,6 +62,12 @@ ft_detect(t_cub *cl) cl->rlist.sqy += cl->mlist->y_step; cl->rlist.side = 1; } + /* ft_printf("sqx [%zu]\t", cl->rlist.sqx); */ + /* ft_printf("sqy [%zu]\n", cl->rlist.sqy); */ + /* (cl->rlist.sqx == 0) ? (cl->rlist.sqx = 1) : 0; */ + /* (cl->rlist.sqy == 0) ? (cl->rlist.sqy = 1) : 0; */ + (cl->rlist.sqx >= cl->mlist->map_h) ? (cl->rlist.sqx = 1) : 0; + (cl->rlist.sqy >= cl->mlist->map_w) ? (cl->rlist.sqy = 1) : 0; if (cl->mlist->map[cl->rlist.sqx][cl->rlist.sqy] == '1') cl->rlist.hit = 1; } -- cgit v1.2.3