-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvehicle.cpp
48 lines (45 loc) · 1.82 KB
/
vehicle.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
#include "vehicle.hpp"
using namespace std;
Vehicle::Vehicle(Road *r, int len, int wid, int h, string col, int max_sp, int acc, char disp, int i, vector<int> position)
{
rd = r;
length = len;
width = wid;
height=h;
id = i;
color=col;
max_speed=max_sp;
acceleration=acc;
pos = position;
velocity.push_back(max_sp);
velocity.push_back(0);
display = disp;
}
Vehicle::Vehicle(const Vehicle &obj)
{
rd=obj.rd;
length = obj.length;
width = obj.width;
height = obj.height;
id = obj.id;
color = obj.color;
max_speed = obj.max_speed;
acceleration = obj.acceleration;
pos = obj.pos;
velocity = obj.velocity;
display = obj.display;
}
int Vehicle::get_length() {return length;}
int Vehicle::get_width() {return width;}
int Vehicle::get_height() {return height;}
int Vehicle::get_id() {return id;}
string Vehicle::get_color() {return color;}
int Vehicle::get_max_speed() {return max_speed;}
int Vehicle::get_acceleration() {return acceleration;}
vector<int> Vehicle::get_pos() {return pos;}
vector<int> Vehicle::get_velocity() {return velocity;}
int Vehicle::get_display_char() {return display;}
void Vehicle::set_acceleration(int acc) {acceleration=acc;}
void Vehicle::set_pos(int x, int y) {pos[0]=x; pos[1]=y;}
void Vehicle::set_velocity(vector<int> v) {velocity[0]=v[0]; velocity[1]=v[1];}
void Vehicle::set_velocity(int x, int y) {velocity[0]=x; velocity[1]=y;}