aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-21 22:14:24 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-21 22:14:24 +0100
commit8f1d0a474a74b166e302046fa47f91450ba05598 (patch)
tree579f236ee07ec0f95e6c292148638c90228bc752
parentFew fixes (diff)
download42-cub3d-8f1d0a474a74b166e302046fa47f91450ba05598.tar.gz
42-cub3d-8f1d0a474a74b166e302046fa47f91450ba05598.tar.bz2
42-cub3d-8f1d0a474a74b166e302046fa47f91450ba05598.tar.xz
42-cub3d-8f1d0a474a74b166e302046fa47f91450ba05598.tar.zst
42-cub3d-8f1d0a474a74b166e302046fa47f91450ba05598.zip
Cured floating point exception
-rw-r--r--Makefile1
-rw-r--r--src/ft_draw_life_bar.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c11281d..ae460b6 100644
--- a/Makefile
+++ b/Makefile
@@ -155,6 +155,7 @@ CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Werror
CFLAGS += -pedantic
+CFLAGS += -march=ivybridge -O2 -pipe
#--------------------------------------------------------------------------------------------------#
ifdef DEBUG
CFLAGS += ${DBG}
diff --git a/src/ft_draw_life_bar.c b/src/ft_draw_life_bar.c
index 25d5ebe..64d1f1f 100644
--- a/src/ft_draw_life_bar.c
+++ b/src/ft_draw_life_bar.c
@@ -92,6 +92,7 @@ static void
int16_t y;
const int16_t scl = cl->mlist.scale;
+ x = ((cl->mlist.map_w * scl) + 20) + (32 * scl) - ((32 * scl) / 4);
y = cl->wlist.y_size - (cl->mlist.map_h * scl) - 10;
while (y < (int16_t)(cl->wlist.y_size - 10))
{
@@ -102,6 +103,8 @@ static void
}
y -= cl->wlist.y_size - (cl->mlist.map_h * scl) - 10;
x -= ((cl->mlist.map_w * scl) + 20) + (32 * scl) - ((32 * scl) / 4);
+ y = (y == 0) ? (1) : (y);
+ x = (x == 0) ? (1) : (x);
cl->h = y;
cl->w = x;
}