From 56ced98666a163c12347831d4c8c79160bb889bc Mon Sep 17 00:00:00 2001 From: Bykosw <48688167+Bykosw@users.noreply.github.com> Date: Sat, 28 Dec 2019 20:43:26 +0300 Subject: [PATCH] Better way to save items. Here's example of saving each item to each file for example .json, you have to create folder with name "items", also you can simply delete all items inside by typing 'Y'. --- items_decoder.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/items_decoder.cpp b/items_decoder.cpp index 2d65592..dcb6c56 100644 --- a/items_decoder.cpp +++ b/items_decoder.cpp @@ -19,7 +19,6 @@ using json = nlohmann::json; int main() { - json jdata; std::ifstream file("items.dat", std::ios::binary | std::ios::ate); int size = file.tellg(); char* data = new char[size]; @@ -44,8 +43,7 @@ int main() memPos += 2; memcpy(&itemCount, data + memPos, 4); memPos += 4; - jdata["itemsdatVersion"] = itemsdatVersion; - jdata["itemCount"] = itemCount; + cout << "Itemcount: " << itemCount << "\nitemsdatVersion: " << itemsdatVersion << endl; for (int i=0;i