summaryrefslogtreecommitdiffstats
path: root/game/server/unloader.cc
diff options
context:
space:
mode:
Diffstat (limited to 'game/server/unloader.cc')
-rw-r--r--game/server/unloader.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/game/server/unloader.cc b/game/server/unloader.cc
index fd838d0..f986a61 100644
--- a/game/server/unloader.cc
+++ b/game/server/unloader.cc
@@ -1,13 +1,13 @@
#include "server/pch.hh"
+
#include "server/unloader.hh"
#include "core/config.hh"
-#include "shared/chunk_aabb.hh"
#include "shared/chunk.hh"
+#include "shared/chunk_aabb.hh"
#include "shared/dimension.hh"
#include "shared/player.hh"
-#include "shared/player.hh"
#include "shared/transform.hh"
#include "server/game.hh"
@@ -15,12 +15,12 @@
#include "server/inhabited.hh"
#include "server/universe.hh"
-static void on_chunk_update(const ChunkUpdateEvent &event)
+static void on_chunk_update(const ChunkUpdateEvent& event)
{
event.dimension->chunks.emplace_or_replace<InhabitedComponent>(event.chunk->get_entity());
}
-static void on_voxel_set(const VoxelSetEvent &event)
+static void on_voxel_set(const VoxelSetEvent& event)
{
event.dimension->chunks.emplace_or_replace<InhabitedComponent>(event.chunk->get_entity());
}
@@ -33,10 +33,9 @@ void unloader::init(void)
void unloader::init_late(void)
{
-
}
-void unloader::fixed_update_late(Dimension *dimension)
+void unloader::fixed_update_late(Dimension* dimension)
{
auto group = dimension->entities.group(entt::get<PlayerComponent, TransformComponent>);
auto boxes = std::vector<ChunkAABB>();
@@ -47,14 +46,14 @@ void unloader::fixed_update_late(Dimension *dimension)
aabb.max = transform.chunk + static_cast<chunk_pos::value_type>(server_game::view_distance.get_value());
boxes.push_back(aabb);
}
-
+
auto view = dimension->chunks.view<ChunkComponent>();
auto chunk_in_view = false;
for(const auto [entity, chunk] : view.each()) {
chunk_in_view = false;
- for(const auto &aabb : boxes) {
+ for(const auto& aabb : boxes) {
if(aabb.contains(chunk.cpos)) {
chunk_in_view = true;
break;