X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fclient%2FMasterState.hpp;h=78ab3703b756539bad02d8f26ce4511efd4886ff;hb=4bf20a032873db3fbb15182e5053284601b90a2f;hp=af2e6aac8710a7b92e4af91566766e8387a43a0c;hpb=1afc887a2040dfdedfa66913e94ff7a9634f648f;p=blank.git diff --git a/src/client/MasterState.hpp b/src/client/MasterState.hpp index af2e6aa..78ab370 100644 --- a/src/client/MasterState.hpp +++ b/src/client/MasterState.hpp @@ -1,12 +1,15 @@ #ifndef BLANK_CLIENT_CLIENTSTATE_HPP_ #define BLANK_CLIENT_CLIENTSTATE_HPP_ +#include "../app/State.hpp" +#include "../net/ConnectionHandler.hpp" + +#include "Client.hpp" #include "InitialState.hpp" #include "InteractiveState.hpp" -#include "../app/State.hpp" -#include "../net/Client.hpp" -#include "../net/PacketHandler.hpp" +#include "../app/Config.hpp" +#include #include @@ -20,23 +23,23 @@ class InteractiveState; class MasterState : public State -, public PacketHandler { +, public ConnectionHandler { public: MasterState( Environment &, - const World::Config &, - const Interface::Config &, - const Client::Config & + Config &, + const World::Config & ); Client &GetClient() noexcept { return client; } Environment &GetEnv() noexcept { return env; } + Config &GetConfig() noexcept { return config; } + const Config &GetConfig() const noexcept { return config; } + World::Config &GetWorldConf() noexcept { return world_conf; } const World::Config &GetWorldConf() const noexcept { return world_conf; } - const Interface::Config &GetInterfaceConf() const noexcept { return intf_conf; } - const Client::Config &GetClientConf() const noexcept { return client_conf; } void Quit(); @@ -46,19 +49,31 @@ public: void Update(int dt) override; void Render(Viewport &) override; + void OnPacketLost(std::uint16_t) override; + void OnTimeout() override; + void On(const Packet::Join &) override; void On(const Packet::Part &) override; + 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; + void On(const Packet::BlockUpdate &) override; + void On(const Packet::Message &) override; private: Environment &env; + Config &config; World::Config world_conf; - const Interface::Config &intf_conf; - const Client::Config &client_conf; std::unique_ptr state; Client client; InitialState init_state; + int login_packet; + }; }