aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_sort_s_t.c
diff options
context:
space:
mode:
authorsalad <salad@saladesk.desktop>2020-03-27 22:23:03 +0100
committersalad <salad@saladesk.desktop>2020-03-27 22:23:03 +0100
commit96534d2121cd9097da83b69ea5947ea93b736edc (patch)
tree92ae970a34d4b72d47c1add1452d4fd8ec5fc0c7 /src/ft_sort_s_t.c
parentMap update (diff)
download42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.tar.gz
42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.tar.bz2
42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.tar.xz
42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.tar.zst
42-cub3d-96534d2121cd9097da83b69ea5947ea93b736edc.zip
jattend que ca clique
Diffstat (limited to 'src/ft_sort_s_t.c')
-rw-r--r--src/ft_sort_s_t.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c
index 8b70fe5..8b05f07 100644
--- a/src/ft_sort_s_t.c
+++ b/src/ft_sort_s_t.c
@@ -34,16 +34,28 @@ float
}
static void
- ft_init_st(int32_t *st_o)
+ ft_init_st(t_cub *cl, int32_t *st_o)
{
int8_t i;
+ int8_t j;
i = 0;
+ j = 0;
while (i < FT_TOTAL_SPRT)
{
- st_o[i] = i;
- i++;
+ if (cl->sprites[i][0].exists == 1)
+ {
+ st_o[j] = i;
+ j++;
+ i++;
+ }
+ else
+ i++;
}
+ i = -1;
+ ft_printf("------------------------------\n");
+ while (++i < FT_TOTAL_SPRT + 1)
+ ft_printf("%d\n", cl->mlist.st_o[i]);
}
static void
@@ -64,11 +76,10 @@ void
int32_t tmp;
i = -1;
- ft_init_st(cl->mlist.st_o);
+ ft_init_st(cl, cl->mlist.st_o);
while (++i < FT_TOTAL_SPRT)
{
- if (dist_tab[i][0]
- && dist_tab[i][0] < dist_tab[i + 1][0])
+ if (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];