| 16878 | } |
| 16879 | |
| 16880 | void Compendium_t::writeUnlocksSaveData() |
| 16881 | { |
| 16882 | char path[PATH_MAX] = ""; |
| 16883 | completePath(path, "savegames/compendium_progress.json", outputdir); |
| 16884 | |
| 16885 | rapidjson::Document exportDocument; |
| 16886 | exportDocument.SetObject(); |
| 16887 | |
| 16888 | const int VERSION = 1; |
| 16889 | |
| 16890 | CustomHelpers::addMemberToRoot(exportDocument, "version", rapidjson::Value(VERSION)); |
| 16891 | rapidjson::Value obj(rapidjson::kObjectType); |
| 16892 | obj.RemoveAllMembers(); |
| 16893 | for ( auto& pair : CompendiumItems_t::unlocks ) |
| 16894 | { |
| 16895 | obj.AddMember(rapidjson::Value(pair.first.c_str(), exportDocument.GetAllocator()), |
| 16896 | rapidjson::Value((int)pair.second), exportDocument.GetAllocator()); |
| 16897 | } |
| 16898 | CustomHelpers::addMemberToRoot(exportDocument, "items", obj); |
| 16899 | |
| 16900 | obj.RemoveAllMembers(); |
| 16901 | for ( auto& pair : CompendiumItems_t::itemUnlocks ) |
| 16902 | { |
| 16903 | obj.AddMember(rapidjson::Value(std::to_string(pair.first).c_str(), exportDocument.GetAllocator()), |
| 16904 | rapidjson::Value((int)pair.second), exportDocument.GetAllocator()); |
| 16905 | } |
| 16906 | CustomHelpers::addMemberToRoot(exportDocument, "items_status", obj); |
| 16907 | |
| 16908 | obj.RemoveAllMembers(); |
| 16909 | for ( auto& pair : AchievementData_t::unlocks ) |
| 16910 | { |
| 16911 | obj.AddMember(rapidjson::Value(pair.first.c_str(), exportDocument.GetAllocator()), |
| 16912 | rapidjson::Value((int)pair.second), exportDocument.GetAllocator()); |
| 16913 | } |
| 16914 | CustomHelpers::addMemberToRoot(exportDocument, "achievements", obj); |
| 16915 | |
| 16916 | obj.RemoveAllMembers(); |
| 16917 | for ( auto& pair : CompendiumWorld_t::unlocks ) |
| 16918 | { |
| 16919 | obj.AddMember(rapidjson::Value(pair.first.c_str(), exportDocument.GetAllocator()), |
| 16920 | rapidjson::Value((int)pair.second), exportDocument.GetAllocator()); |
| 16921 | } |
| 16922 | CustomHelpers::addMemberToRoot(exportDocument, "world", obj); |
| 16923 | |
| 16924 | obj.RemoveAllMembers(); |
| 16925 | for ( auto& pair : CompendiumCodex_t::unlocks ) |
| 16926 | { |
| 16927 | obj.AddMember(rapidjson::Value(pair.first.c_str(), exportDocument.GetAllocator()), |
| 16928 | rapidjson::Value((int)pair.second), exportDocument.GetAllocator()); |
| 16929 | } |
| 16930 | CustomHelpers::addMemberToRoot(exportDocument, "codex", obj); |
| 16931 | |
| 16932 | obj.RemoveAllMembers(); |
| 16933 | for ( auto& pair : CompendiumMonsters_t::unlocks ) |
| 16934 | { |
| 16935 | obj.AddMember(rapidjson::Value(pair.first.c_str(), exportDocument.GetAllocator()), |
| 16936 | rapidjson::Value((int)pair.second), exportDocument.GetAllocator()); |
| 16937 | } |
nothing calls this directly
no test coverage detected