X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2Fworld.cpp;h=8ea99fec247734e6b592c6e65fc231f9350a49c7;hb=9240fdf2e68ee014da0d0a89a7fb2f29ebf28e2d;hp=242da2796af047fc0e41f472fdb5b20126009b05;hpb=b066e776622f96e906600a0c4a08de392bd03676;p=blank.git diff --git a/src/world/world.cpp b/src/world/world.cpp index 242da27..8ea99fe 100644 --- a/src/world/world.cpp +++ b/src/world/world.cpp @@ -127,7 +127,8 @@ glm::mat4 EntityState::Transform(const glm::ivec3 &reference) const noexcept { Player::Player(Entity &e, ChunkIndex &c) : entity(e) -, chunks(c) { +, chunks(c) +, inv_slot(0) { } @@ -144,8 +145,6 @@ World::World(const BlockTypeRegistry &types, const Config &config) : config(config) , block_type(types) , chunks(types) -// TODO: set spawn base and extent from config -, spawn_index(chunks.MakeIndex(Chunk::Pos(0, 0, 0), 3)) , players() , entities() , light_direction(config.light_direction) @@ -154,7 +153,7 @@ World::World(const BlockTypeRegistry &types, const Config &config) } World::~World() { - chunks.UnregisterIndex(spawn_index); + } @@ -166,10 +165,8 @@ Player *World::AddPlayer(const std::string &name) { } Entity &entity = AddEntity(); entity.Name(name); - // TODO: load from save file here entity.Bounds({ { -0.5f, -0.5f, -0.5f }, { 0.5f, 0.5f, 0.5f } }); entity.WorldCollidable(true); - entity.Position(config.spawn); ChunkIndex &index = chunks.MakeIndex(entity.ChunkCoords(), 6); players.emplace_back(entity, index); return &players.back(); @@ -186,10 +183,8 @@ Player *World::AddPlayer(const std::string &name, std::uint32_t id) { return nullptr; } entity->Name(name); - // TODO: load from save file here entity->Bounds({ { -0.5f, -0.5f, -0.5f }, { 0.5f, 0.5f, 0.5f } }); entity->WorldCollidable(true); - entity->Position(config.spawn); ChunkIndex &index = chunks.MakeIndex(entity->ChunkCoords(), 6); players.emplace_back(*entity, index); return &players.back();