From 93560082584b9afefd38d7aa1b4a8f2a5acd249d Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Sun, 17 Oct 2021 14:44:17 +0700 Subject: [PATCH] Code refactoring. --- Client.cpp | 3 +-- Server.cpp | 5 +---- engine/network/ClientUDP.cpp | 4 ---- engine/network/ServerUDP.cpp | 3 --- 4 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Client.cpp b/Client.cpp index c48d904..93ccbd4 100644 --- a/Client.cpp +++ b/Client.cpp @@ -120,9 +120,8 @@ void Client::processCustomPacket(MsgType type, sf::Packet& packet) { if(_removeBonusCallBack != nullptr) _removeBonusCallBack(ObjectNameTag(tmp)); break; - default: - throw std::logic_error{"Client::processCustomPacket: unknown MsgType"}; + return; } } diff --git a/Server.cpp b/Server.cpp index 4dc6af1..292ff5b 100644 --- a/Server.cpp +++ b/Server.cpp @@ -116,12 +116,9 @@ void Server::processCustomPacket(MsgType type, sf::Packet& packet, sf::Uint16 se if(player.first != senderId) _socket.send(sendPacket, player.first); } - break; - case MsgType::Error: - break; default: - throw std::logic_error{"Server::processCustomPacket: unknown MsgType"}; + return; } } diff --git a/engine/network/ClientUDP.cpp b/engine/network/ClientUDP.cpp index 404a0fb..b00ba65 100644 --- a/engine/network/ClientUDP.cpp +++ b/engine/network/ClientUDP.cpp @@ -120,10 +120,6 @@ bool ClientUDP::process() processDisconnect(targetId); break; - - case MsgType::Confirm: - - break; default: processCustomPacket(type, packet); } diff --git a/engine/network/ServerUDP.cpp b/engine/network/ServerUDP.cpp index caf8266..c3abfdf 100644 --- a/engine/network/ServerUDP.cpp +++ b/engine/network/ServerUDP.cpp @@ -117,9 +117,6 @@ bool ServerUDP::process() _socket.sendRely(sendPacket, client); processDisconnect(senderId); - break; - case MsgType::Confirm: - break; default: processCustomPacket(type, packet, senderId);