add 'tags.toml' file
This commit is contained in:
@@ -413,6 +413,25 @@ void ContentLoader::load() {
|
||||
if (io::exists(contentFile)) {
|
||||
loadContent(io::read_json(contentFile));
|
||||
}
|
||||
|
||||
// Load attached tags
|
||||
io::path tagsFile = folder / "tags.toml";
|
||||
if (io::exists(tagsFile)) {
|
||||
auto tagsMap = io::read_object(tagsFile);
|
||||
for (const auto& [key, list] : tagsMap.asObject()) {
|
||||
for (const auto& id : list) {
|
||||
const auto& stringId = id.asString();
|
||||
if (auto block = builder.blocks.get(stringId)) {
|
||||
block->tags.push_back(key);
|
||||
if (auto item = builder.items.get(stringId + BLOCK_ITEM_SUFFIX)) {
|
||||
item->tags.push_back(key);
|
||||
}
|
||||
} else if (auto item = builder.items.get(stringId)) {
|
||||
item->tags.push_back(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
Reference in New Issue
Block a user