]> git.localhorst.tv Git - blank.git/blobdiff - src/client/InteractiveState.hpp
add packet for merging player state back to client
[blank.git] / src / client / InteractiveState.hpp
index 65c92d08ff33ab905421201621c575a1ce333250..91a5944181b2979b075ddce9b80af3d2657a5a48 100644 (file)
@@ -1,13 +1,18 @@
 #ifndef BLANK_CLIENT_INTERACTIVESTATE_HPP_
 #define BLANK_CLIENT_INTERACTIVESTATE_HPP_
 
+#include "../app/IntervalTimer.hpp"
 #include "../app/State.hpp"
 #include "../io/WorldSave.hpp"
+#include "../model/Skeletons.hpp"
 #include "../ui/Interface.hpp"
 #include "../world/BlockTypeRegistry.hpp"
 #include "../world/ChunkRenderer.hpp"
+#include "../world/EntityState.hpp"
 #include "../world/World.hpp"
 
+#include <list>
+
 
 namespace blank {
 
@@ -25,6 +30,7 @@ public:
 
        World &GetWorld() noexcept { return world; }
        Interface &GetInterface() noexcept { return interface; }
+       Skeletons &GetSkeletons() noexcept { return skeletons; }
 
        void OnEnter() override;
 
@@ -32,13 +38,27 @@ public:
        void Update(int dt) override;
        void Render(Viewport &) override;
 
+       void PushPlayerUpdate(const Entity &);
+       void MergePlayerCorrection(std::uint16_t, const EntityState &);
+
 private:
        MasterState &master;
        BlockTypeRegistry block_types;
        WorldSave save;
        World world;
-       ChunkRenderer chunk_renderer;
        Interface interface;
+       ChunkRenderer chunk_renderer;
+       Skeletons skeletons;
+       IntervalTimer update_timer;
+
+       struct PlayerHistory {
+               EntityState state;
+               int timestamp;
+               std::uint16_t packet;
+               PlayerHistory(EntityState s, int t, std::uint16_t p)
+               : state(s), timestamp(t), packet(p) { }
+       };
+       std::list<PlayerHistory> player_hist;
 
 };