aboutsummaryrefslogtreecommitdiff
path: root/source/30-game/Ires.cpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2023-06-13 16:46:47 -0700
committerrtk0c <[email protected]>2023-06-13 16:46:47 -0700
commit21192a63e1411134b3096da4e5f9a511f913c9b9 (patch)
treec19ceb7fbdc9e0ce226e0dfb4d7a1132c52e7854 /source/30-game/Ires.cpp
parent32e74b9c81b57a9c0284f5374536439d581bc4b6 (diff)
Changeset: 95 Change Uid's serialization format from JSON array to just a string
Diffstat (limited to 'source/30-game/Ires.cpp')
-rw-r--r--source/30-game/Ires.cpp12
1 files changed, 11 insertions, 1 deletions
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<rapidjson::FileWriteStream> 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()) {