refactor World

This commit is contained in:
MihailRis
2024-08-11 16:30:58 +03:00
parent bcdff0f816
commit 3d3da1cdcd
8 changed files with 102 additions and 83 deletions
+3 -2
View File
@@ -29,6 +29,7 @@ Level::Level(
events(std::make_unique<LevelEvents>()),
entities(std::make_unique<Entities>(this)),
settings(settings) {
auto& worldInfo = world->getInfo();
auto& cameraIndices = content->getIndices(ResourceType::CAMERA);
for (size_t i = 0; i < cameraIndices.size(); i++) {
auto camera = std::make_shared<Camera>();
@@ -46,8 +47,8 @@ Level::Level(
cameras.push_back(std::move(camera));
}
if (world->nextEntityId) {
entities->setNextID(world->nextEntityId);
if (worldInfo.nextEntityId) {
entities->setNextID(worldInfo.nextEntityId);
}
auto inv = std::make_shared<Inventory>(
world->getNextInventoryId(), DEF_PLAYER_INVENTORY_SIZE