-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrip.cpp
58 lines (48 loc) · 844 Bytes
/
trip.cpp
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
#include "trip.h"
#include "whatever.h"
void Trip::adjustTrip(Direction dir, int step)
{
double value = 0.1;
switch(step) {
case 0:
value = 0.1;
break;
case 1:
value = 0.2;
break;
case 2:
value = 0.5;
break;
case 3:
value = 1.0;
break;
default:
value = 0.1;
}
changeTrips(dir, value);
}
void Trip::adjustTrip(Direction dir) {
adjustTrip(dir, 0);
}
void Trip::increaseTrip() {
adjustTrip(forward);
}
void Trip::decreaseTrip() {
adjustTrip(backward);
}
void Trip::resetTrip() {
tripDistance = 0.0;
}
void Trip::changeTrips(Direction dir, double amount) {
if(dir == forward)
{
tripDistance += amount;
}
else if(dir == backward)
{
tripDistance -= amount;
}
}
void Trip::registerTripMaster(TripMaster* _tripMaster) {
tripMaster = _tripMaster;
}