MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / PlayerCodexes

Method PlayerCodexes

source/game/StarPlayerCodexes.cpp:10–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace Star {
9
10PlayerCodexes::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
24Json PlayerCodexes::toJson() const {
25 return jsonFromMapV<StringMap<CodexEntry>>(m_codexes, [](CodexEntry const& entry) { return entry.second; });

Callers

nothing calls this directly

Calls 4

singletonClass · 0.85
assetsMethod · 0.80
codexMethod · 0.80
codexDatabaseMethod · 0.80

Tested by

no test coverage detected