BlockMaterial struct + minor refactor and docs

This commit is contained in:
MihailRis
2024-03-07 10:55:19 +03:00
parent f8e02e1b3b
commit 8658a170bc
4 changed files with 86 additions and 43 deletions
+18 -19
View File
@@ -10,8 +10,7 @@
#include "ContentPack.h"
#include "../logic/scripting/scripting.h"
ContentBuilder::~ContentBuilder() {
}
ContentBuilder::~ContentBuilder() {}
void ContentBuilder::add(Block* def) {
checkIdentifier(def->name);
@@ -127,25 +126,25 @@ Content* ContentBuilder::build() {
ContentIndices::ContentIndices(
std::vector<Block*> blockDefs,
std::vector<ItemDef*> itemDefs)
: blockDefs(blockDefs),
itemDefs(itemDefs) {
}
std::vector<ItemDef*> itemDefs
) : blockDefs(blockDefs),
itemDefs(itemDefs)
{}
Content::Content(ContentIndices* indices,
std::unique_ptr<DrawGroups> drawGroups,
std::unordered_map<std::string, Block*> blockDefs,
std::unordered_map<std::string, ItemDef*> itemDefs,
std::unordered_map<std::string, std::unique_ptr<ContentPackRuntime>> packs)
: blockDefs(blockDefs),
itemDefs(itemDefs),
indices(indices),
packs(std::move(packs)),
drawGroups(std::move(drawGroups)) {
}
Content::Content(
ContentIndices* indices,
std::unique_ptr<DrawGroups> drawGroups,
std::unordered_map<std::string, Block*> blockDefs,
std::unordered_map<std::string, ItemDef*> itemDefs,
std::unordered_map<std::string, std::unique_ptr<ContentPackRuntime>> packs
) : blockDefs(blockDefs),
itemDefs(itemDefs),
indices(indices),
packs(std::move(packs)),
drawGroups(std::move(drawGroups))
{}
Content::~Content() {
}
Content::~Content() {}
Block* Content::findBlock(std::string id) const {
auto found = blockDefs.find(id);