Better player save & load

This commit is contained in:
InfiniteCoder
2024-03-03 00:25:05 +03:00
parent 0157213a56
commit 9376dc4165
6 changed files with 34 additions and 35 deletions
+1 -6
View File
@@ -12,11 +12,6 @@
#include "../items/Inventory.h"
#include "../items/Inventories.h"
const float DEF_PLAYER_Y = 100.0f;
const float DEF_PLAYER_SPEED = 4.0f;
const int DEF_PLAYER_INVENTORY_SIZE = 40;
Level::Level(World* world, const Content* content, EngineSettings& settings)
: world(world),
content(content),
@@ -25,7 +20,7 @@ Level::Level(World* world, const Content* content, EngineSettings& settings)
events(std::make_unique<LevelEvents>()),
settings(settings)
{
auto inv = std::make_shared<Inventory>(0, DEF_PLAYER_INVENTORY_SIZE);
auto inv = std::make_shared<Inventory>(world->getNextInventoryId(), DEF_PLAYER_INVENTORY_SIZE);
auto player = spawnObject<Player>(glm::vec3(0, DEF_PLAYER_Y, 0), DEF_PLAYER_SPEED, inv);
uint matrixSize = (settings.chunks.loadDistance + settings.chunks.padding) * 2;