-
Notifications
You must be signed in to change notification settings - Fork 2
/
defs.h
69 lines (61 loc) · 1.38 KB
/
defs.h
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef PROJET_F1_C_DEFS_H
#define PROJET_F1_C_DEFS_H
#define SIG_RACE_START (SIGUSR1)
#define SIG_RACE_STOP (SIGUSR2)
static const unsigned int test_times[] = {2, 2, 2};
static const unsigned int qualif_times[] = {5, 4, 3};
static const int race_laps = 50;
static const int simulation_divider = 1;
/* Valid status for pilote.status */
typedef enum status status;
enum status {
driving,
pitstop,
out,
eliminated,
end
};
/* A queue of laps, each the time by sector and a pointer to the next lap */
typedef struct lap lap;
struct lap {
lap* nextlap;
float time_s1;
float time_s2;
float time_s3;
float time_pit;
};
/* Best time by sector and best lap time */
typedef struct bestlap bestlap;
struct bestlap {
float best_s1;
float best_s2;
float best_s3;
float best_lap;
};
/* The scoreboard for each pilote */
typedef struct scoreboard scoreboard;
struct scoreboard {
int car_id;
lap* races[7]; // Point the first lap of each race
lap* last_lap[7]; //Point to races[i]->nextLap->nextLap->...->nextLap, the current lap
bestlap bestlaps[7];
};
/* Shared structure, used by pilotes to give infos on their race */
typedef struct pilote pilote;
struct pilote {
int car_id;
int cli_idx;
int lap_cnt;
int sector;
int position;
float time;
enum status status;
int has_changed;
scoreboard* scores;
};
typedef struct rank_item rank_item;
struct rank_item{
pilote* car;
float bestlap;
};
#endif