Auto content packs detection

This commit is contained in:
MihailRis
2023-12-20 20:54:03 +03:00
parent bcfdc55277
commit 3ad903449e
8 changed files with 93 additions and 100 deletions
+13 -5
View File
@@ -27,9 +27,11 @@ World::World(string name,
path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content)
const Content* content,
const std::vector<ContentPack> packs)
: settings(settings),
content(content),
packs(packs),
name(name),
seed(seed) {
wfile = new WorldFiles(directory, settings.debug);
@@ -71,8 +73,9 @@ Level* World::create(string name,
path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content) {
World* world = new World(name, directory, seed, settings, content);
const Content* content,
const std::vector<ContentPack>& packs) {
World* world = new World(name, directory, seed, settings, content, packs);
Player* player = new Player(vec3(0, DEF_PLAYER_Y, 0), DEF_PLAYER_SPEED);
return new Level(world, content, player, settings);
}
@@ -88,8 +91,9 @@ ContentLUT* World::checkIndices(const path& directory,
Level* World::load(path directory,
EngineSettings& settings,
const Content* content) {
unique_ptr<World> world (new World(".", directory, 0, settings, content));
const Content* content,
const std::vector<ContentPack>& packs) {
unique_ptr<World> world (new World(".", directory, 0, settings, content, packs));
auto& wfile = world->wfile;
if (!wfile->readWorldInfo(world.get())) {
@@ -103,3 +107,7 @@ Level* World::load(path directory,
world.release();
return level;
}
const std::vector<ContentPack>& World::getPacks() const {
return packs;
}