mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
added serializable class
This commit is contained in:
parent
a9b55f35be
commit
8466c42896
6 changed files with 64 additions and 41 deletions
|
|
@ -44,7 +44,7 @@ void Inventory::move(
|
|||
}
|
||||
}
|
||||
|
||||
void Inventory::read(const dynamic::Map* src) {
|
||||
void Inventory::deserialize(dynamic::Map* src) {
|
||||
auto slotsarr = src->list("slots");
|
||||
size_t slotscount = std::min(slotsarr->size(), slots.size());
|
||||
for (size_t i = 0; i < slotscount; i++) {
|
||||
|
|
@ -56,7 +56,7 @@ void Inventory::read(const dynamic::Map* src) {
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<dynamic::Map> Inventory::write() const {
|
||||
std::unique_ptr<dynamic::Map> Inventory::serialize() const {
|
||||
auto map = std::make_unique<dynamic::Map>();
|
||||
auto& slotsarr = map->putList("slots");
|
||||
for (size_t i = 0; i < slots.size(); i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue