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

Method BiomeDatabase

source/game/StarBiomeDatabase.cpp:13–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace Star {
12
13BiomeDatabase::BiomeDatabase() {
14 auto assets = Root::singleton().assets();
15
16 // 'type' here is the extension of the file, and determines the selector type
17 auto scanFiles = [=](String const& type, ConfigMap& map) {
18 auto& files = assets->scanExtension(type);
19 assets->queueJsons(files);
20 for (auto& path : files) {
21 auto parameters = assets->json(path);
22 if (parameters.isNull())
23 continue;
24
25 auto name = parameters.getString("name");
26 if (map.contains(name))
27 throw BiomeException(strf("Duplicate {} generator name '{}'", type, name));
28 map[name] = {path, name, parameters};
29 }
30 };
31
32 scanFiles("biome", m_biomes);
33 scanFiles("weather", m_weathers);
34}
35
36StringList BiomeDatabase::biomeNames() const {
37 return m_biomes.keys();

Callers

nothing calls this directly

Calls 8

singletonClass · 0.85
strfFunction · 0.85
assetsMethod · 0.80
queueJsonsMethod · 0.80
jsonMethod · 0.80
getStringMethod · 0.80
isNullMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected