-
Notifications
You must be signed in to change notification settings - Fork 0
/
vehicle.hpp
71 lines (51 loc) · 1.97 KB
/
vehicle.hpp
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
#ifndef VEHICLE_HPP
#define VEHICLE_HPP
#include <string>
#include <sstream>
#include <iostream>
#include "weapon.hpp"
#include "owner.hpp"
using namespace std;
class vehicle {
protected:
string vrn;
int type, propulsion, maxcrew, price; /// common parameters of all vehicle types
owner *vehicle_owner;
public:
// -- Constructor --
vehicle(string _vrn, owner *_vehicle_owner, int _propulsion, int _maxcrew, int _price, int _type);
// -- Destructor --
virtual ~vehicle(){}
// -- Modify functions --
void modifyvrn(string nvrn); /// sets register number to the given one
void modifyowner(owner *nvehicle_owner); /// sets vehicle owner to the given one
void modifypropulsion(int npropulsion); /// sets propulsion type to the given one
void modifymaxcrew(int nmaxcrew); /// sets maximum crew to the given one
void modifyprice(int nprice); /// sets price to the given one
// - virtual modify functions -
virtual void modifyweapon(int pos, weapon w) {}
virtual void modifycs(int cs) {}
virtual void modifyml(int ml) {}
virtual void modifyms(int ms) {}
virtual void modifymp(int mp) {}
virtual void modifyhn(int hn) {}
virtual void modifyes(bool es) {}
virtual void addweapon(int weapontype) {}
virtual void removeweapon(int weaponposition) {}
// -- Auxiliary functions --
string rvrn(); /// returns vehicle register number
int checktype(); /// returns vehicle type
/// - virtual auxiliary functions -
virtual int nweapons() { return 0; } /// fighters and destroyers will have their own definition
virtual int ocapacity() { return 0; } /// fighters and destroyers will have their own definition
virtual int hn() { return 0; }
// -- Show functions --
string showpropulsion(); /// returns propulsion type in readable way
// - virtual show functions -
virtual void show() = 0;
virtual void showweapon(int a) {}
// -- Formatting functions --
string to_string(int a);
virtual string reg() = 0;
};
#endif