player inventory id fix
This commit is contained in:
parent
7ae5c4e3a1
commit
6c7497eee6
@ -27,7 +27,7 @@ Level::Level(World* world, const Content* content, EngineSettings& settings)
|
||||
{
|
||||
objCounter = 0;
|
||||
physics = new PhysicsSolver(glm::vec3(0, -22.6f, 0));
|
||||
auto inv = std::make_shared<Inventory>(world->getNextInventoryId(), DEF_PLAYER_INVENTORY_SIZE);
|
||||
auto inv = std::make_shared<Inventory>(0, DEF_PLAYER_INVENTORY_SIZE);
|
||||
player = spawnObject<Player>(glm::vec3(0, DEF_PLAYER_Y, 0), DEF_PLAYER_SPEED, inv);
|
||||
|
||||
uint matrixSize = (settings.chunks.loadDistance+
|
||||
|
||||
@ -72,6 +72,9 @@ Level* World::create(std::string name,
|
||||
const std::vector<ContentPack>& packs) {
|
||||
auto world = new World(name, directory, seed, settings, content, packs);
|
||||
auto level = new Level(world, content, settings);
|
||||
auto inventory = level->player->getInventory();
|
||||
inventory->setId(world->getNextInventoryId());
|
||||
level->inventories->store(inventory);
|
||||
return level;
|
||||
}
|
||||
|
||||
@ -90,6 +93,7 @@ Level* World::load(fs::path directory,
|
||||
|
||||
auto level = new Level(world.get(), content, settings);
|
||||
wfile->readPlayer(level->player);
|
||||
level->inventories->store(level->player->getInventory());
|
||||
world.release();
|
||||
return level;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user