X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fclient%2FMasterState.hpp;h=50773a63d03e7d700b7e7e5b7c63d6da8f8b33c3;hb=38a4cffc0b6aa58e49d24c06aad7bee14cb6515d;hp=8eeadf051811596a8f3db3b47306b6b537925f62;hpb=51a0b19601cb4b044c7eee1782aa85fc3a399d33;p=blank.git diff --git a/src/client/MasterState.hpp b/src/client/MasterState.hpp index 8eeadf0..50773a6 100644 --- a/src/client/MasterState.hpp +++ b/src/client/MasterState.hpp @@ -1,12 +1,13 @@ #ifndef BLANK_CLIENT_CLIENTSTATE_HPP_ #define BLANK_CLIENT_CLIENTSTATE_HPP_ +#include "Client.hpp" #include "InitialState.hpp" #include "InteractiveState.hpp" #include "../app/State.hpp" -#include "../net/Client.hpp" #include "../net/ConnectionHandler.hpp" +#include #include @@ -54,6 +55,16 @@ public: void On(const Packet::SpawnEntity &) override; void On(const Packet::DespawnEntity &) override; void On(const Packet::EntityUpdate &) override; + void On(const Packet::PlayerCorrection &) override; + void On(const Packet::ChunkBegin &) override; + void On(const Packet::ChunkData &) override; + +private: + /// flag entity as updated by given packet + /// returns false if the update should be ignored + bool UpdateEntity(std::uint32_t id, std::uint16_t seq); + /// drop update information or given entity + void ClearEntity(std::uint32_t id); private: Environment &env; @@ -67,6 +78,13 @@ private: int login_packet; + struct UpdateStatus { + std::uint16_t last_packet; + int last_update; + }; + std::map update_status; + IntervalTimer update_timer; + }; }