]> git.localhorst.tv Git - blank.git/blobdiff - src/server/ClientConnection.hpp
give network players a model
[blank.git] / src / server / ClientConnection.hpp
index c5efb51bbd412d7d9aeffbe7e5b29803b83f4a2d..99657de3642d262b70dbdcee5504e32efb66680b 100644 (file)
 #include <deque>
 #include <list>
 #include <SDL_net.h>
+#include <vector>
 
 
 namespace blank {
+
+class CompositeModel;
+
 namespace server {
 
 class Server;
@@ -51,6 +55,10 @@ public:
        ChunkIndex &PlayerChunks() noexcept { return *player.chunks; }
        const ChunkIndex &PlayerChunks() const noexcept { return *player.chunks; }
 
+       void SetPlayerModel(const CompositeModel &) noexcept;
+       bool HasPlayerModel() const noexcept;
+       const CompositeModel &GetPlayerModel() const noexcept;
+
 private:
        struct SpawnStatus {
                // the entity in question
@@ -77,7 +85,8 @@ private:
 
        void SendSpawn(SpawnStatus &);
        void SendDespawn(SpawnStatus &);
-       void SendUpdate(SpawnStatus &);
+       void QueueUpdate(SpawnStatus &);
+       void SendUpdates();
 
        void CheckPlayerFix();
 
@@ -87,9 +96,12 @@ private:
        Server &server;
        Connection conn;
        Player player;
+       const CompositeModel *player_model;
        std::list<SpawnStatus> spawns;
        unsigned int confirm_wait;
 
+       std::vector<SpawnStatus *> entity_updates;
+
        EntityState player_update_state;
        std::uint16_t player_update_pack;
        IntervalTimer player_update_timer;