-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.h
68 lines (52 loc) · 1.34 KB
/
driver.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
//
// Created by scorpion on 01.03.16.
//
#pragma once
#include "vertex.h"
#include "person.h"
struct Driver {
int id_garage;
pair<int, int> onWorkTime;
vector<Person> passengers;
// driver id
int did;
int restTime;
int currentTime;
int currentDistance;
int currentCity;
bool onMove;
int lastAirport;
int nAirports;
Driver(int id = 0, int did = 0, int nA = 0) : id_garage(id), did(did), nAirports(nA) {
currentDistance = 0;
inAiport = false;
currentCity = id;
restTime = 9 * 60 * 60;
onMove = false;
lastAirport = -1;
}
void setAirport(int airport) {
lastAirport = airport;
}
void setCity(int newCity) {
currentCity = newCity;
if (currentCity < nAirports)
lastAirport = currentCity;
}
bool canAirport(int pr, int neA) {
if (lastAirport == -1)
return true;
if (neA == lastAirport) {
return true;
}
return true;
}
void set_time(int start = 0, int finish = 0) {
onWorkTime = make_pair(start, finish);
currentTime = start;
}
bool operator < (const Driver &dr) const {
return (onWorkTime.first < dr.onWorkTime.first || onWorkTime.first == dr.onWorkTime.first && did < dr.did);
}
bool inAiport;
};