added serializable class

This commit is contained in:
DanielProl1xy
2024-01-30 15:53:49 +03:00
parent a9b55f35be
commit 8466c42896
6 changed files with 64 additions and 41 deletions
+2 -2
View File
@@ -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++) {