mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
12e6a92798
26 changed files with 191 additions and 116 deletions
|
|
@ -82,10 +82,6 @@ void World::write(Level* level) {
|
|||
wfile->writePlayer(level->player);
|
||||
}
|
||||
|
||||
const float DEF_PLAYER_Y = 100.0f;
|
||||
const float DEF_PLAYER_SPEED = 4.0f;
|
||||
const int DEF_PLAYER_INVENTORY_SIZE = 40;
|
||||
|
||||
Level* World::create(std::string name,
|
||||
std::string type,
|
||||
fs::path directory,
|
||||
|
|
@ -94,12 +90,8 @@ Level* World::create(std::string name,
|
|||
const Content* content,
|
||||
const std::vector<ContentPack>& packs) {
|
||||
auto world = new World(name, type, directory, seed, settings, content, packs);
|
||||
auto inv = std::make_shared<Inventory>(world->getNextInventoryId(), DEF_PLAYER_INVENTORY_SIZE);
|
||||
auto player = new Player(
|
||||
glm::vec3(0, DEF_PLAYER_Y, 0), DEF_PLAYER_SPEED, inv
|
||||
);
|
||||
auto level = new Level(world, content, player, settings);
|
||||
level->inventories->store(player->getInventory());
|
||||
auto level = new Level(world, content, settings);
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
|
|
@ -116,13 +108,8 @@ Level* World::load(fs::path directory,
|
|||
throw world_load_error("could not to find world.json");
|
||||
}
|
||||
|
||||
auto inv = std::make_shared<Inventory>(0, DEF_PLAYER_INVENTORY_SIZE);
|
||||
auto player = new Player(
|
||||
glm::vec3(0, DEF_PLAYER_Y, 0), DEF_PLAYER_SPEED, inv
|
||||
);
|
||||
auto level = new Level(world.get(), content, player, settings);
|
||||
wfile->readPlayer(player);
|
||||
level->inventories->store(player->getInventory());
|
||||
auto level = new Level(world.get(), content, settings);
|
||||
wfile->readPlayer(level->player);
|
||||
world.release();
|
||||
return level;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue