mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 14:01:49 +00:00
remove extra inventory convert implementation
This commit is contained in:
parent
c34bc184a4
commit
5ff42929f9
2 changed files with 6 additions and 10 deletions
|
|
@ -91,17 +91,11 @@ void Inventory::convert(const ContentReport* report) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove
|
|
||||||
void Inventory::convert(dv::value& data, const ContentReport* report) {
|
void Inventory::convert(dv::value& data, const ContentReport* report) {
|
||||||
auto& slotsarr = data["slots"];
|
Inventory inventory;
|
||||||
for (auto& item : data["slots"]) {
|
inventory.deserialize(data);
|
||||||
itemid_t id = item["id"].asInteger(ITEM_EMPTY);
|
inventory.convert(report);
|
||||||
itemid_t replacement = report->items.getId(id);
|
data = inventory.serialize();
|
||||||
item["id"] = replacement;
|
|
||||||
if (replacement == 0 && item.has("count")) {
|
|
||||||
item.erase("count");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t Inventory::npos = -1;
|
const size_t Inventory::npos = -1;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ class Inventory : public Serializable {
|
||||||
int64_t id;
|
int64_t id;
|
||||||
std::vector<ItemStack> slots;
|
std::vector<ItemStack> slots;
|
||||||
public:
|
public:
|
||||||
|
Inventory() = default;
|
||||||
|
|
||||||
Inventory(int64_t id, size_t size);
|
Inventory(int64_t id, size_t size);
|
||||||
|
|
||||||
Inventory(const Inventory& orig);
|
Inventory(const Inventory& orig);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue