diff --git a/src/items/Inventory.cpp b/src/items/Inventory.cpp index dd869a93..92f925ef 100644 --- a/src/items/Inventory.cpp +++ b/src/items/Inventory.cpp @@ -91,17 +91,11 @@ void Inventory::convert(const ContentReport* report) { } } -// TODO: remove void Inventory::convert(dv::value& data, const ContentReport* report) { - auto& slotsarr = data["slots"]; - for (auto& item : data["slots"]) { - itemid_t id = item["id"].asInteger(ITEM_EMPTY); - itemid_t replacement = report->items.getId(id); - item["id"] = replacement; - if (replacement == 0 && item.has("count")) { - item.erase("count"); - } - } + Inventory inventory; + inventory.deserialize(data); + inventory.convert(report); + data = inventory.serialize(); } const size_t Inventory::npos = -1; diff --git a/src/items/Inventory.hpp b/src/items/Inventory.hpp index 95d0936a..e12029f8 100644 --- a/src/items/Inventory.hpp +++ b/src/items/Inventory.hpp @@ -14,6 +14,8 @@ class Inventory : public Serializable { int64_t id; std::vector slots; public: + Inventory() = default; + Inventory(int64_t id, size_t size); Inventory(const Inventory& orig);