-
Notifications
You must be signed in to change notification settings - Fork 0
/
landing.c
40 lines (36 loc) · 1.27 KB
/
landing.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
37
38
39
40
/*
** EPITECH PROJECT, 2022
** B-MUL-100-LYN-1-1-myradar-mael.rabot
** File description:
** landing
*/
#include "include/my.h"
void landing_direct_line(plane_t *plane)
{
if (plane->position_case == CASE_5 && plane->pos.x > plane->target.x)
plane->landed = TRUE;
if (plane->position_case == CASE_6 && plane->pos.y > plane->target.y)
plane->landed = TRUE;
if (plane->position_case == CASE_7 && plane->pos.x < plane->target.x)
plane->landed = TRUE;
if (plane->position_case == CASE_8 && plane->pos.y < plane->target.y)
plane->landed = TRUE;
}
void landing(plane_t *plane)
{
if (visibility_check(plane) == FALSE)
return;
if (plane->position_case == CASE_1 && plane->pos.x > plane->target.x &&
plane->pos.y > plane->target.y)
plane->landed = TRUE;
if (plane->position_case == CASE_2 && plane->pos.x < plane->target.x &&
plane->pos.y > plane->target.y)
plane->landed = TRUE;
if (plane->position_case == CASE_3 && plane->pos.x < plane->target.x &&
plane->pos.y < plane->target.y)
plane->landed = TRUE;
if (plane->position_case == CASE_4 && plane->pos.x > plane->target.x &&
plane->pos.y < plane->target.y)
plane->landed = TRUE;
landing_direct_line(plane);
}