-
Notifications
You must be signed in to change notification settings - Fork 0
/
weapon.cpp
33 lines (27 loc) · 798 Bytes
/
weapon.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
#include <iostream>
#include "platform.hpp"
using namespace std;
// -- Constructor --
weapon::weapon() { type = 0; }
weapon::weapon(int ctype) {
type = ctype;
if (type == 1) { ocapacity = 10; }
else if (type == 2) { ocapacity = 20; }
else if (type == 3) { ocapacity = 5; }
else if (type == 4) { ocapacity = 15; }
else { ocapacity = 0; }
}
// -- Modify functions --
void weapon::modify(int ntype) {
type = ntype;
if (type == 1) { ocapacity = 10; }
else if (type == 2) { ocapacity = 20; }
else if (type == 3) { ocapacity = 5; }
else if (type == 4) { ocapacity = 15; }
else { ocapacity = 0; }
}
// -- Auxiliary functions --
int weapon::returntype() { return type; }
int weapon::focapacity() { return ocapacity; }
// -- Show functions --
void weapon::show() { cout << type << endl; }