aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-27 17:04:08 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-27 17:04:08 +0100
commit82a55e7b0758f1b0afa45ac19953a9eb398f3771 (patch)
tree068d46879685355e0f795b805f4b2977f503254e
parentSegv fix (diff)
download42-cub3d-82a55e7b0758f1b0afa45ac19953a9eb398f3771.tar.gz
42-cub3d-82a55e7b0758f1b0afa45ac19953a9eb398f3771.tar.bz2
42-cub3d-82a55e7b0758f1b0afa45ac19953a9eb398f3771.tar.xz
42-cub3d-82a55e7b0758f1b0afa45ac19953a9eb398f3771.tar.zst
42-cub3d-82a55e7b0758f1b0afa45ac19953a9eb398f3771.zip
Fixed shit
-rw-r--r--map/map_one.cub6
-rw-r--r--src/ft_sort_s_t.c18
2 files changed, 21 insertions, 3 deletions
diff --git a/map/map_one.cub b/map/map_one.cub
index fbe3ef9..4b88719 100644
--- a/map/map_one.cub
+++ b/map/map_one.cub
@@ -12,6 +12,10 @@ S ./media/img/sprites/pillar.xpm
S3 ./media/img/sprites/pylon.xpm
S4 ./media/img/sprites/larry.xpm
S5 ./media/img/sprites/linus.xpm
+S6 ./media/img/sprites/linus.xpm
+S7 ./media/img/sprites/linus.xpm
+S8 ./media/img/sprites/pylon.xpm
+S9 ./media/img/sprites/linus.xpm
T ./media/img/sprites/spikes.xpm
@@ -19,7 +23,7 @@ SH 2
1111111111111111111
1000000000000000001
- 1000000000000000001
+ 1000000080000000001
1000000000000000001
111111111111000000000005000001
10000000000000000T0T0T00000001
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c
index 31ae237..9cbde8b 100644
--- a/src/ft_sort_s_t.c
+++ b/src/ft_sort_s_t.c
@@ -34,6 +34,19 @@ float
}
static void
+ ft_init_st(int32_t *st_o)
+{
+ int8_t i;
+
+ i = 0;
+ while (i < FT_TOTAL_SPRT)
+ {
+ st_o[i] = i;
+ i++;
+ }
+}
+
+static void
ft_swap_them(int16_t i, float **dist_tab)
{
float tmp_i[4096];
@@ -50,10 +63,11 @@ void
int32_t tmp;
i = -1;
+ ft_init_st(cl->mlist.st_o);
while (++i < FT_TOTAL_SPRT)
{
- cl->mlist.st_o[i] = i;
- if (dist_tab[i][0] < dist_tab[i + 1][0])
+ if (i < FT_TOTAL_SPRT && dist_tab[i][0]
+ && dist_tab[i][0] < dist_tab[i + 1][0])
{
tmp = cl->mlist.st_o[i];
cl->mlist.st_o[i] = cl->mlist.st_o[i + 1];