-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cargo.hpp
37 lines (28 loc) · 943 Bytes
/
Cargo.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
#pragma once
#include <cstddef>
#include <string>
#include "Subscriber.hpp"
namespace {
constexpr size_t MAX_AMOUNT_OF_CARGO{ 1000 };
}
//class resposible for manage commodity in game
class Cargo : public Subscriber {
public:
Cargo(const std::string& name, size_t amount, size_t basePrice);
virtual ~Cargo();
std::string getName() const { return name_; }
size_t getAmount() const { return amount_; }
size_t getBasePrice() const { return basePrice_; }
void setAmount(size_t amount);
virtual Cargo& operator+=(const size_t amount) = 0;
virtual Cargo& operator-=(const size_t amount) = 0;
virtual bool operator==(const Cargo& cargo) const = 0;
virtual size_t getPrice() const = 0;
virtual bool isExpired() const = 0;
// override from Subscriber
virtual void nextDay() override = 0;
protected:
const std::string name_;
size_t amount_ {};
size_t basePrice_ {};
};