aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-02-13 23:41:27 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-02-13 23:41:27 +0100
commitfa8d8e8518e669215aee2d2521a9cd1fdabac096 (patch)
tree6afe4337c6857e3c367ceae93c0c2885f3259c5b /src
parentNice changes, secured segvs (diff)
download42-cub3d-fa8d8e8518e669215aee2d2521a9cd1fdabac096.tar.gz
42-cub3d-fa8d8e8518e669215aee2d2521a9cd1fdabac096.tar.bz2
42-cub3d-fa8d8e8518e669215aee2d2521a9cd1fdabac096.tar.xz
42-cub3d-fa8d8e8518e669215aee2d2521a9cd1fdabac096.tar.zst
42-cub3d-fa8d8e8518e669215aee2d2521a9cd1fdabac096.zip
Secured segv the better way
Diffstat (limited to 'src')
-rw-r--r--src/ft_detect.c6
-rw-r--r--src/ft_key_events.c4
2 files changed, 2 insertions, 8 deletions
diff --git a/src/ft_detect.c b/src/ft_detect.c
index e91ca50..7153123 100644
--- a/src/ft_detect.c
+++ b/src/ft_detect.c
@@ -62,12 +62,6 @@ 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;
}
diff --git a/src/ft_key_events.c b/src/ft_key_events.c
index 07c192b..da416fa 100644
--- a/src/ft_key_events.c
+++ b/src/ft_key_events.c
@@ -80,8 +80,8 @@ int
if (keycode <= 3)
{
(*fun_ptr[keycode])(clist);
- (pl->pos_y < 0.4) ? (pl->pos_y = 0.4) : 0;
- (pl->pos_x < 0.4) ? (pl->pos_x = 0.4) : 0;
+ (pl->pos_y < 1) ? (pl->pos_y = 1.1) : 0;
+ (pl->pos_x < 1) ? (pl->pos_x = 1.1) : 0;
(pl->pos_y > ml->map_h - 1.4) ? (pl->pos_y = ml->map_h - 1.4) : 0;
(pl->pos_x > ml->map_w - 1.4) ? (pl->pos_x = ml->map_w - 1.4) : 0;
ft_draw_scene(clist);