| 8 | namespace Star { |
| 9 | |
| 10 | PlayerCodexes::PlayerCodexes(Json const& variant) { |
| 11 | if (variant) { |
| 12 | auto assets = Root::singleton().assets(); |
| 13 | auto codexData = jsonToMapV<StringMap<bool>>(variant, mem_fn(&Json::toBool)); |
| 14 | for (auto pair : codexData) { |
| 15 | if (auto codex = Root::singleton().codexDatabase()->codex(pair.first)) { |
| 16 | m_codexes[pair.first] = CodexEntry{codex, pair.second}; |
| 17 | } else { |
| 18 | Logger::debug("Failed to load missing codex '{}'", pair.first); |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | Json PlayerCodexes::toJson() const { |
| 25 | return jsonFromMapV<StringMap<CodexEntry>>(m_codexes, [](CodexEntry const& entry) { return entry.second; }); |
nothing calls this directly
no test coverage detected