fixed server world upload
This commit is contained in:
@@ -13,6 +13,7 @@ private:
|
|||||||
ClientGame* m_Game;
|
ClientGame* m_Game;
|
||||||
public:
|
public:
|
||||||
WorldClient(ClientGame* game);
|
WorldClient(ClientGame* game);
|
||||||
|
virtual ~WorldClient();
|
||||||
|
|
||||||
virtual void HandlePacket(const protocol::WorldBeginDataPacket* packet) override;
|
virtual void HandlePacket(const protocol::WorldBeginDataPacket* packet) override;
|
||||||
virtual void HandlePacket(const protocol::WorldDataPacket* packet) override;
|
virtual void HandlePacket(const protocol::WorldDataPacket* packet) override;
|
||||||
|
|||||||
@@ -41,9 +41,7 @@ void Client::CloseConnection() {
|
|||||||
m_Game->SetGameState(game::GameState::Disconnected);
|
m_Game->SetGameState(game::GameState::Disconnected);
|
||||||
m_Connexion.CloseConnection();
|
m_Connexion.CloseConnection();
|
||||||
|
|
||||||
|
Reset();
|
||||||
m_Game->Reset();
|
|
||||||
m_Game->GetPlayers().clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Tick(std::uint64_t delta) {
|
void Client::Tick(std::uint64_t delta) {
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ WorldClient::WorldClient(ClientGame* game) : game::World(game), protocol::Packet
|
|||||||
GetDispatcher()->RegisterHandler(protocol::PacketType::UpdateMobStates, this);
|
GetDispatcher()->RegisterHandler(protocol::PacketType::UpdateMobStates, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WorldClient::~WorldClient() {
|
||||||
|
GetDispatcher()->UnregisterHandler(this);
|
||||||
|
}
|
||||||
|
|
||||||
void WorldClient::HandlePacket(const protocol::WorldBeginDataPacket* packet) {
|
void WorldClient::HandlePacket(const protocol::WorldBeginDataPacket* packet) {
|
||||||
LoadMap(packet);
|
LoadMap(packet);
|
||||||
if (m_Game->GetGameState() == game::GameState::Game) {
|
if (m_Game->GetGameState() == game::GameState::Game) {
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ void ServerConnexion::HandlePacket(const protocol::PlayerLoginPacket* packet) {
|
|||||||
SendPacket(&statePacket);
|
SendPacket(&statePacket);
|
||||||
|
|
||||||
protocol::WorldBeginDataPacket headerDataPacket(m_Server->GetGame().GetWorld());
|
protocol::WorldBeginDataPacket headerDataPacket(m_Server->GetGame().GetWorld());
|
||||||
protocol::WorldBeginDataPacket dataPacket(m_Server->GetGame().GetWorld());
|
protocol::WorldDataPacket dataPacket(m_Server->GetGame().GetWorld());
|
||||||
SendPacket(&headerDataPacket);
|
SendPacket(&headerDataPacket);
|
||||||
SendPacket(&dataPacket);
|
SendPacket(&dataPacket);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user