Delivery point editor done

This commit is contained in:
Andrew nuark G 2020-12-23 04:26:18 +07:00
parent a6c080d36b
commit 3e196f3574
22 changed files with 379 additions and 74 deletions

View file

@ -20,10 +20,28 @@ QString dpoint_entity::title() const {
return this->_title;
}
void dpoint_entity::set_title(const QString &new_title) {
this->_title = new_title;
}
const QVector<storage_entity> dpoint_entity::storages() {
return this->_storages;
}
void dpoint_entity::set_storages(QVector<storage_entity> storages) {
this->_storages = storages;
}
void dpoint_entity::remove_storage(entity_id sid) {
std::remove_if(this->_storages.begin(), this->_storages.end(), [sid](storage_entity ent) {
return ent.id() == sid;
});
}
void dpoint_entity::add_storage(storage_entity ent) {
this->_storages.push_back(ent);
}
void dpoint_entity::serialize(QDataStream &output) {
output << this->_id << this->_title << this->_storages.size();
for (auto &item : this->_storages) {

View file

@ -23,7 +23,11 @@ public:
entity_id id() const;
entity_id dispatcher() const;
QString title() const;
void set_title(const QString &new_title);
const QVector<storage_entity> storages();
void set_storages(QVector<storage_entity> storages);
void remove_storage(entity_id sid);
void add_storage(storage_entity ent);
void serialize(QDataStream &output);
void deserialize(QDataStream &input);

View file

@ -16,6 +16,10 @@ unsigned int storage_entity::capacity() const {
return this->_capacity;
}
void storage_entity::set_capacity(unsigned int new_capacity) {
this->_capacity = new_capacity;
}
const QVector<cargo_entity> storage_entity::cargo() {
return this->_cargo;
}

View file

@ -22,6 +22,7 @@ public:
entity_id id() const;
unsigned int capacity() const;
void set_capacity(unsigned int new_capacity);
const QVector<cargo_entity> cargo();
void add_cargo(cargo_entity object, bool &success);