Add vessel entity
This commit is contained in:
parent
d00ec79847
commit
b0edbda4fe
3 changed files with 55 additions and 0 deletions
24
entities/vessel_entity.cpp
Normal file
24
entities/vessel_entity.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#include "vessel_entity.h"
|
||||||
|
|
||||||
|
|
||||||
|
unsigned long long vessel_entity::__global_id = 0;
|
||||||
|
|
||||||
|
vessel_entity::vessel_entity(const dpoint_entity &harbor, unsigned int capacity) : _harbor(harbor), _capacity(capacity) {
|
||||||
|
this->_id = ++vessel_entity::__global_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long long vessel_entity::id() {
|
||||||
|
return this->_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dpoint_entity vessel_entity::harbor() {
|
||||||
|
return this->_harbor;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int vessel_entity::capacity() {
|
||||||
|
return this->_capacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVector<cargo_entity> vessel_entity::cargo() {
|
||||||
|
return this->_cargo;
|
||||||
|
}
|
||||||
29
entities/vessel_entity.h
Normal file
29
entities/vessel_entity.h
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef VESSEL_ENTITY_H
|
||||||
|
#define VESSEL_ENTITY_H
|
||||||
|
|
||||||
|
#include "cargo_entity.h"
|
||||||
|
#include "dpoint_entity.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class vessel_entity
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static unsigned long long __global_id;
|
||||||
|
|
||||||
|
unsigned long long _id;
|
||||||
|
dpoint_entity _harbor;
|
||||||
|
unsigned int _capacity;
|
||||||
|
QVector<cargo_entity> _cargo;
|
||||||
|
|
||||||
|
public:
|
||||||
|
vessel_entity() = default;
|
||||||
|
vessel_entity(const dpoint_entity &harbor, unsigned int capacity);
|
||||||
|
|
||||||
|
unsigned long long id();
|
||||||
|
const dpoint_entity harbor();
|
||||||
|
unsigned int capacity();
|
||||||
|
const QVector<cargo_entity> cargo();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VESSEL_ENTITY_H
|
||||||
|
|
@ -15,6 +15,7 @@ SOURCES += \
|
||||||
entities/cargo_entity.cpp \
|
entities/cargo_entity.cpp \
|
||||||
entities/dpoint_entity.cpp \
|
entities/dpoint_entity.cpp \
|
||||||
entities/storage_entity.cpp \
|
entities/storage_entity.cpp \
|
||||||
|
entities/vessel_entity.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
storageeditdialog.cpp \
|
storageeditdialog.cpp \
|
||||||
usereditdialog.cpp \
|
usereditdialog.cpp \
|
||||||
|
|
@ -27,6 +28,7 @@ HEADERS += \
|
||||||
entities/cargo_entity.h \
|
entities/cargo_entity.h \
|
||||||
entities/dpoint_entity.h \
|
entities/dpoint_entity.h \
|
||||||
entities/storage_entity.h \
|
entities/storage_entity.h \
|
||||||
|
entities/vessel_entity.h \
|
||||||
storageeditdialog.h \
|
storageeditdialog.h \
|
||||||
usereditdialog.h \
|
usereditdialog.h \
|
||||||
vesseleditdialog.h
|
vesseleditdialog.h
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue