-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_push_a.c
36 lines (33 loc) · 1.3 KB
/
ft_push_a.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_push_a.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dlana <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/09/29 20:22:51 by dlana #+# #+# */
/* Updated: 2021/09/30 21:03:08 by dlana ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ft_push_a(t_point *points)
{
t_list *tmp;
if (points->count_b == 0)
return ;
ft_cut_list(&tmp, &points->b);
if (points->a == 0)
{
tmp->prev = tmp;
tmp->next = tmp;
}
if (points->a != 0)
ft_paste_list(&tmp, &points->a);
points->a = tmp;
points->count_b--;
points->count_a++;
if (points->count_b == 0)
points->b = points->empty_list;
if (points->checker == 0)
write (1, "pa\n", 3);
}