All entities now have GID
This commit is contained in:
parent
eb097588ba
commit
2be2e9f5e3
9 changed files with 59 additions and 11 deletions
|
|
@ -1,8 +1,10 @@
|
|||
#include "cargo_entity.h"
|
||||
|
||||
|
||||
entity_id cargo_entity::__global_id = 0;
|
||||
|
||||
cargo_entity::cargo_entity() {
|
||||
this->_id += QRandomGenerator().generate64();
|
||||
this->_id = ++cargo_entity::__global_id + QRandomGenerator().generate64();
|
||||
}
|
||||
|
||||
cargo_entity::cargo_entity(const QString &title, unsigned int volume) : _title(title), _volume(volume) {
|
||||
|
|
@ -33,3 +35,11 @@ void cargo_entity::serialize(QDataStream &output) {
|
|||
void cargo_entity::deserialize(QDataStream &input) {
|
||||
input >> this->_id >> this->_title >> this->_volume;
|
||||
}
|
||||
|
||||
void cargo_entity::preloadGlobalId(entity_id gid) {
|
||||
cargo_entity::__global_id = gid;
|
||||
}
|
||||
|
||||
entity_id cargo_entity::GID() {
|
||||
return cargo_entity::__global_id;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue