From 5f0d3fb28218ce5ce079683ddf3202d741dd210b Mon Sep 17 00:00:00 2001 From: salad Date: Sat, 28 Mar 2020 14:50:36 +0100 Subject: 8 still doesnt swap but its cool --- src/ft_sort_s_t.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/ft_sort_s_t.c') diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c index 8b05f07..6ce1ff3 100644 --- a/src/ft_sort_s_t.c +++ b/src/ft_sort_s_t.c @@ -39,11 +39,16 @@ static void int8_t i; int8_t j; - i = 0; j = 0; + i = -1; + while (++i < FT_TOTAL_SPRT) + { + st_o[i] = -1; + } + i = 0; while (i < FT_TOTAL_SPRT) { - if (cl->sprites[i][0].exists == 1) + if (cl->sprites[i]->exists == 1) { st_o[j] = i; j++; @@ -52,10 +57,6 @@ static void else i++; } - i = -1; - ft_printf("------------------------------\n"); - while (++i < FT_TOTAL_SPRT + 1) - ft_printf("%d\n", cl->mlist.st_o[i]); } static void @@ -79,7 +80,7 @@ void ft_init_st(cl, cl->mlist.st_o); while (++i < FT_TOTAL_SPRT) { - if (dist_tab[i][0] < dist_tab[i + 1][0]) + if (cl->mlist.st_o[i] != -1 && 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]; @@ -89,6 +90,10 @@ void } } i = -1; + ft_printf("------------------------------\n"); + while (++i < FT_TOTAL_SPRT + 1) + ft_printf("%d\n", cl->mlist.st_o[i]); + i = -1; while (++i < FT_TOTAL_SPRT + 1) ft_memdel((void*)&dist_tab[i]); ft_memdel((void*)&dist_tab); -- cgit v1.2.3