Entities update
This commit is contained in:
parent
4a3951938a
commit
05776f19f3
6 changed files with 18 additions and 7 deletions
|
|
@ -53,7 +53,7 @@
|
||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="documentMode">
|
<property name="documentMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "dpoint_entity.h"
|
#include "dpoint_entity.h"
|
||||||
|
|
||||||
dpoint_entity::dpoint_entity(const QString &title) : _title(title) {
|
dpoint_entity::dpoint_entity(entity_id dispatcher_id, const QString &title) : _dispatcher_id(dispatcher_id), _title(title) {
|
||||||
this->_id = 0;
|
this->_id = dispatcher_id;
|
||||||
auto hash = QCryptographicHash::hash(title.toLocal8Bit(), QCryptographicHash::Md5);
|
auto hash = QCryptographicHash::hash(title.toLocal8Bit(), QCryptographicHash::Md5);
|
||||||
for (auto bit : hash) {
|
for (auto bit : hash) {
|
||||||
this->_id += bit;
|
this->_id += bit;
|
||||||
|
|
@ -12,6 +12,10 @@ entity_id dpoint_entity::id() const {
|
||||||
return this->_id;
|
return this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entity_id dpoint_entity::dispatcher() const {
|
||||||
|
return this->_dispatcher_id;
|
||||||
|
}
|
||||||
|
|
||||||
QString dpoint_entity::title() const {
|
QString dpoint_entity::title() const {
|
||||||
return this->_title;
|
return this->_title;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,16 @@
|
||||||
class dpoint_entity : public IEntity {
|
class dpoint_entity : public IEntity {
|
||||||
private:
|
private:
|
||||||
entity_id _id;
|
entity_id _id;
|
||||||
|
entity_id _dispatcher_id;
|
||||||
QString _title;
|
QString _title;
|
||||||
QVector<storage_entity> _storages;
|
QVector<storage_entity> _storages;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
dpoint_entity() = default;
|
dpoint_entity() = default;
|
||||||
dpoint_entity(const QString &title);
|
dpoint_entity(entity_id dispatcher_id, const QString &title);
|
||||||
|
|
||||||
entity_id id() const;
|
entity_id id() const;
|
||||||
|
entity_id dispatcher() const;
|
||||||
QString title() const;
|
QString title() const;
|
||||||
const QVector<storage_entity> storages();
|
const QVector<storage_entity> storages();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ entity_id vessel_entity::id() const {
|
||||||
return this->_id;
|
return this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entity_id vessel_entity::skipper() const {
|
||||||
|
return this->_skipper_id;
|
||||||
|
}
|
||||||
|
|
||||||
entity_id vessel_entity::harbor() const {
|
entity_id vessel_entity::harbor() const {
|
||||||
return this->_harbor_id;
|
return this->_harbor_id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ public:
|
||||||
vessel_entity(entity_id skipper_id, entity_id harbor_id, unsigned int capacity);
|
vessel_entity(entity_id skipper_id, entity_id harbor_id, unsigned int capacity);
|
||||||
|
|
||||||
entity_id id() const;
|
entity_id id() const;
|
||||||
|
entity_id skipper() const;
|
||||||
entity_id harbor() const;
|
entity_id harbor() const;
|
||||||
unsigned int capacity() const;
|
unsigned int capacity() const;
|
||||||
const QVector<cargo_entity> cargo();
|
const QVector<cargo_entity> cargo();
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,8 @@ void st_test::vessel_entity_serialization_test() {
|
||||||
f.open(QIODevice::WriteOnly);
|
f.open(QIODevice::WriteOnly);
|
||||||
stream.setDevice(&f);
|
stream.setDevice(&f);
|
||||||
|
|
||||||
dpoint_entity test_harbor("test_harbor_for_vessel");
|
dpoint_entity test_harbor(0, "test_harbor_for_vessel");
|
||||||
ent1 = vessel_entity(test_harbor.id(), 256);
|
ent1 = vessel_entity(0, test_harbor.id(), 256);
|
||||||
ent1.serialize(stream);
|
ent1.serialize(stream);
|
||||||
|
|
||||||
stream.setDevice(nullptr);
|
stream.setDevice(nullptr);
|
||||||
|
|
@ -265,7 +265,7 @@ void st_test::apparatus_check_auth_subsystem() {
|
||||||
void st_test::apparatus_check_object_subsystem() {
|
void st_test::apparatus_check_object_subsystem() {
|
||||||
apparatus::init();
|
apparatus::init();
|
||||||
auto os = apparatus::instance()->get_object_subsystem();
|
auto os = apparatus::instance()->get_object_subsystem();
|
||||||
dpoint_entity p("test");
|
dpoint_entity p(0, "test");
|
||||||
{
|
{
|
||||||
bool test = os->add_dpoint(p);
|
bool test = os->add_dpoint(p);
|
||||||
QVERIFY(test);
|
QVERIFY(test);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue