Merge pull request #362 from MihailRis/new-pack-props

New pack properties
This commit is contained in:
MihailRis 2024-11-10 21:46:44 +03:00 committed by GitHub
commit a17314d5e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,8 @@
# Documentation
Documentation for the engine of version 0.24.
Documentation for the engine of in-development version 0.25.
[Documentation for stable release 0.24.x.](https://github.com/MihailRis/VoxelEngine-Cpp/blob/release-0.24/doc/en/main-page.md)
## Sections

View File

@ -22,6 +22,8 @@
}
```
Вместо `creator` можно указать массив `creators`
Уровни зависимостей указываются с помощью префиксов в имени:
- '!' - обязательная зависимость
- '?' - опциональная зависимость

View File

@ -1,6 +1,8 @@
# Документация
Документация движка версии 0.24.
Документация движка разрабатываемой версии 0.25.
[Документация стабильной версии 0.24.x.](https://github.com/MihailRis/VoxelEngine-Cpp/blob/release-0.24/doc/ru/main-page.md)
## Разделы

View File

@ -76,8 +76,19 @@ ContentPack ContentPack::read(const fs::path& folder) {
root.at("id").get(pack.id);
root.at("title").get(pack.title);
root.at("version").get(pack.version);
if (root.has("creators")) {
const auto& creators = root["creators"];
for (int i = 0; i < creators.size(); i++) {
if (i > 0) {
pack.creator += ", ";
}
pack.creator += creators[i].asString();
}
} else {
root.at("creator").get(pack.creator);
}
root.at("description").get(pack.description);
root.at("source").get(pack.source);
pack.folder = folder;
if (auto found = root.at("dependencies")) {

View File

@ -44,6 +44,7 @@ struct ContentPack {
std::string description = "no description";
fs::path folder;
std::vector<DependencyPack> dependencies;
std::string source = "";
fs::path getContentFile() const;