-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpit.h
86 lines (60 loc) · 2.64 KB
/
pit.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/***************************************************************************
file : pit.h
created : Thu Mai 15 2:41:00 CET 2003
copyright : (C) 2003 by Bernhard Wymann
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _PIT_H_
#define _PIT_H_
#include "driver.h"
#include "spline.h"
#define NPOINTS 7
class Driver;
class Pit {
public:
Pit(tSituation *s, Driver *driver);
~Pit();
void setPitstop(bool pitstop);
bool getPitstop() { return pitstop; }
void setInPit(bool inpitlane) { this->inpitlane = inpitlane; }
bool getInPit() { return inpitlane; }
float getPitOffset(float offset, float fromstart);
bool isBetween(float fromstart);
float getNPitStart() { return p[1].x; }
float getNPitLoc() { return p[3].x; }
float getNPitEnd() { return p[5].x; }
float toSplineCoord(float x);
float getSpeedlimitSqr() { return speedlimitsqr; }
float getSpeedlimit() { return speedlimit; }
void update();
int getRepair();
float getFuel();
private:
tTrack *track;
tCarElt *car;
tTrackOwnPit *mypit; /* pointer to my pit */
tTrackPitInfo *pitinfo; /* general pit info */
SplinePoint p[NPOINTS]; /* spline points */
Spline *spline; /* spline */
bool pitstop; /* pitstop planned */
bool inpitlane; /* we are still in the pit lane */
float pitentry; /* distance to start line of the pit entry */
float pitexit; /* distance to the start line of the pit exit */
float speedlimitsqr; /* pit speed limit squared */
float speedlimit; /* pit speed limit */
bool fuelchecked; /* fuel statistics updated */
float lastfuel; /* the fuel available when we cross the start lane */
float lastpitfuel; /* amount refueled, special case when we refuel */
float fuelperlap; /* the maximum amount of fuel we needed for a lap */
static const float SPEED_LIMIT_MARGIN;
static const int PIT_DAMMAGE;
};
#endif // _PIT_H_