From 4909d1dbc2d060c365f7cabc97e80a90afe56d80 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Mon, 6 Apr 2020 01:24:49 +0200 Subject: [PATCH] [ServerWorld] Sending Scene state more often. --- source/client/scene/RenderingController.cpp | 4 +--- source/client/scene/RenderingController.hpp | 2 -- source/server/world/ServerWorld.cpp | 3 ++- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/source/client/scene/RenderingController.cpp b/source/client/scene/RenderingController.cpp index 692e6244..b4cae409 100644 --- a/source/client/scene/RenderingController.cpp +++ b/source/client/scene/RenderingController.cpp @@ -34,7 +34,7 @@ #include "Registry.hpp" -void RenderingController::update(entt::DefaultRegistry ®istry) { +void RenderingController::draw(entt::DefaultRegistry ®istry, gk::RenderTarget &target, gk::RenderStates states) { registry.view().each([&](auto entity, auto &drawableDef) { const InventoryCubeDef &cubeDef = drawableDef.getInventoryCubeDef(); @@ -48,9 +48,7 @@ void RenderingController::update(entt::DefaultRegistry ®istry) { registry.remove(entity); }); -} -void RenderingController::draw(entt::DefaultRegistry ®istry, gk::RenderTarget &target, gk::RenderStates states) { registry.view().each([&](auto, auto &drawable, auto &transformable) { gk::RenderStates drawStates = states; drawStates.transform *= transformable.getTransform(); diff --git a/source/client/scene/RenderingController.hpp b/source/client/scene/RenderingController.hpp index 78c515f0..75af6d10 100644 --- a/source/client/scene/RenderingController.hpp +++ b/source/client/scene/RenderingController.hpp @@ -31,8 +31,6 @@ class RenderingController : public AbstractController { public: - void update(entt::DefaultRegistry ®istry) override; - void draw(entt::DefaultRegistry ®istry, gk::RenderTarget &target, gk::RenderStates states) override; }; diff --git a/source/server/world/ServerWorld.cpp b/source/server/world/ServerWorld.cpp index 334c5d3a..bf38ff85 100644 --- a/source/server/world/ServerWorld.cpp +++ b/source/server/world/ServerWorld.cpp @@ -57,9 +57,10 @@ void ServerWorld::update() { m_scene.update(); // FIXME: Should be placed somewhere else + // FIXME: Shouldn't be sent that often static int lastTime = m_clock.getTicks(true); int now = m_clock.getTicks(true); - if (now - lastTime > 100) { + if (now - lastTime > 10) { lastTime = now; sf::Packet packet;