]> git.localhorst.tv Git - blank.git/blobdiff - src/server/ClientConnection.hpp
fix Location for debug build
[blank.git] / src / server / ClientConnection.hpp
index 4927d1ce831fb9ab26c15cbeb68db9826b3c497c..bd42241d9974897a8210afc3479e500c3e6e1c53 100644 (file)
@@ -19,7 +19,7 @@
 
 namespace blank {
 
-class CompositeModel;
+class Model;
 
 namespace server {
 
@@ -46,7 +46,7 @@ public:
        }
        /// send the previously prepared packet
        std::uint16_t Send();
-       /// send the previously prepared packet of non-default length
+       /// send the previously prepared packet of given payload length
        std::uint16_t Send(std::size_t len);
 
        void AttachPlayer(Player &);
@@ -57,9 +57,11 @@ public:
        ChunkIndex &PlayerChunks() noexcept { return input->GetPlayer().GetChunks(); }
        const ChunkIndex &PlayerChunks() const noexcept { return input->GetPlayer().GetChunks(); }
 
-       void SetPlayerModel(const CompositeModel &) noexcept;
+       void SetPlayerModel(const Model &) noexcept;
        bool HasPlayerModel() const noexcept;
-       const CompositeModel &GetPlayerModel() const noexcept;
+       const Model &GetPlayerModel() const noexcept;
+
+       bool ChunkInRange(const glm::ivec3 &) const noexcept;
 
 private:
        struct SpawnStatus {
@@ -81,12 +83,16 @@ private:
        void On(const Packet::Login &) override;
        void On(const Packet::Part &) override;
        void On(const Packet::PlayerUpdate &) override;
+       void On(const Packet::Message &) override;
 
+       void CheckEntities();
        bool CanSpawn(const Entity &) const noexcept;
        bool CanDespawn(const Entity &) const noexcept;
 
        void SendSpawn(SpawnStatus &);
        void SendDespawn(SpawnStatus &);
+       /// true if entity updates are pushed to the client this frame
+       bool SendingUpdates() const noexcept;
        void QueueUpdate(SpawnStatus &);
        void SendUpdates();
 
@@ -98,20 +104,22 @@ private:
        Server &server;
        Connection conn;
        std::unique_ptr<DirectInput> input;
-       const CompositeModel *player_model;
+       const Model *player_model;
        std::list<SpawnStatus> spawns;
        unsigned int confirm_wait;
 
        std::vector<SpawnStatus *> entity_updates;
+       unsigned int entity_updates_skipped;
 
        EntityState player_update_state;
        std::uint16_t player_update_pack;
-       IntervalTimer player_update_timer;
+       CoarseTimer player_update_timer;
        std::uint8_t old_actions;
 
        ChunkTransmitter transmitter;
        std::deque<glm::ivec3> chunk_queue;
        glm::ivec3 old_base;
+       unsigned int chunk_blocks_skipped;
 
 };