New world format, fixes

This commit is contained in:
MihailRis
2023-11-05 15:32:46 +03:00
committed by GitHub
parent 0c65b13f4e
commit 0cf8382e95
21 changed files with 350 additions and 173 deletions
+13 -6
View File
@@ -1,6 +1,8 @@
#include "Level.h"
#include "World.h"
#include "LevelEvents.h"
#include "../lighting/Lighting.h"
#include "../voxels/Chunk.h"
#include "../voxels/Chunks.h"
#include "../voxels/ChunksController.h"
#include "../voxels/ChunksStorage.h"
@@ -9,19 +11,24 @@
#include "../physics/PhysicsSolver.h"
#include "../objects/Player.h"
Level::Level(World* world, Player* player, Chunks* chunks, ChunksStorage* chunksStorage, PhysicsSolver* physics) :
world(world),
player(player),
chunks(chunks),
chunksStorage(chunksStorage),
physics(physics) {
Level::Level(World* world, Player* player, Chunks* chunks, ChunksStorage* chunksStorage, PhysicsSolver* physics, LevelEvents* events) :
world(world),
player(player),
chunks(chunks),
chunksStorage(chunksStorage),
physics(physics),
events(events) {
lighting = new Lighting(chunks);
chunksController = new ChunksController(this, chunks, lighting);
playerController = new PlayerController(this);
events->listen(EVT_CHUNK_HIDDEN, [this](lvl_event_type type, Chunk* chunk) {
this->chunksStorage->remove(chunk->x, chunk->z);
});
}
Level::~Level(){
delete chunks;
delete events;
delete physics;
delete player;
delete lighting;