fixed server world upload

This commit is contained in:
2023-08-15 13:47:56 +02:00
parent b3157be641
commit 380ecf3a27
4 changed files with 7 additions and 4 deletions

View File

@@ -41,9 +41,7 @@ void Client::CloseConnection() {
m_Game->SetGameState(game::GameState::Disconnected);
m_Connexion.CloseConnection();
m_Game->Reset();
m_Game->GetPlayers().clear();
Reset();
}
void Client::Tick(std::uint64_t delta) {

View File

@@ -26,6 +26,10 @@ WorldClient::WorldClient(ClientGame* game) : game::World(game), protocol::Packet
GetDispatcher()->RegisterHandler(protocol::PacketType::UpdateMobStates, this);
}
WorldClient::~WorldClient() {
GetDispatcher()->UnregisterHandler(this);
}
void WorldClient::HandlePacket(const protocol::WorldBeginDataPacket* packet) {
LoadMap(packet);
if (m_Game->GetGameState() == game::GameState::Game) {

View File

@@ -120,7 +120,7 @@ void ServerConnexion::HandlePacket(const protocol::PlayerLoginPacket* packet) {
SendPacket(&statePacket);
protocol::WorldBeginDataPacket headerDataPacket(m_Server->GetGame().GetWorld());
protocol::WorldBeginDataPacket dataPacket(m_Server->GetGame().GetWorld());
protocol::WorldDataPacket dataPacket(m_Server->GetGame().GetWorld());
SendPacket(&headerDataPacket);
SendPacket(&dataPacket);