From 21192a63e1411134b3096da4e5f9a511f913c9b9 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Tue, 13 Jun 2023 16:46:47 -0700 Subject: Changeset: 95 Change Uid's serialization format from JSON array to just a string --- source/30-game/Ires.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/30-game/Ires.cpp') diff --git a/source/30-game/Ires.cpp b/source/30-game/Ires.cpp index bfa4cdf..4f8da85 100644 --- a/source/30-game/Ires.cpp +++ b/source/30-game/Ires.cpp @@ -393,10 +393,20 @@ void IresManager::Save(IresObject* ires, const fs::path& filePath) { char writerBuffer[65536]; rapidjson::FileWriteStream stream(file, writerBuffer, sizeof(writerBuffer)); rapidjson::PrettyWriter writer(stream); - writer.SetFormatOptions(rapidjson::PrettyFormatOptions::kFormatSingleLineArray); + // We no longer need this after disabling BRUSSEL_Uid_WRITE_USE_ARRAY +// writer.SetFormatOptions(rapidjson::PrettyFormatOptions::kFormatSingleLineArray); +#if BRUSSEL_Uid_WRITE_USE_ARRAY +# warning "Writing Uid in array format but single line formatting isn't enabled, this might cause excessively long ires files." +#endif root.Accept(writer); } +void IresManager::OverwriteAllToDisk() { + for (const auto& [DISCARD, ires] : mObjByUid) { + Save(ires.Get()); + } +} + IresObject* IresManager::FindIres(const Uid& uid) const { auto iter = mObjByUid.find(uid); if (iter != mObjByUid.end()) { -- cgit v1.2.3-70-g09d2