summaryrefslogtreecommitdiffstats
path: root/src/NetworkClient.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-09-16 17:48:19 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:31 +0100
commit892b9732751b64c2016ba476801e1fe4ed4e750f (patch)
tree99aa40953de5d61e30d47bdf345ee2cb9c3c18e1 /src/NetworkClient.cpp
parent2017-09-15 (diff)
downloadAltCraft-892b9732751b64c2016ba476801e1fe4ed4e750f.tar
AltCraft-892b9732751b64c2016ba476801e1fe4ed4e750f.tar.gz
AltCraft-892b9732751b64c2016ba476801e1fe4ed4e750f.tar.bz2
AltCraft-892b9732751b64c2016ba476801e1fe4ed4e750f.tar.lz
AltCraft-892b9732751b64c2016ba476801e1fe4ed4e750f.tar.xz
AltCraft-892b9732751b64c2016ba476801e1fe4ed4e750f.tar.zst
AltCraft-892b9732751b64c2016ba476801e1fe4ed4e750f.zip
Diffstat (limited to 'src/NetworkClient.cpp')
-rw-r--r--src/NetworkClient.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/NetworkClient.cpp b/src/NetworkClient.cpp
index 5877952..027eeb5 100644
--- a/src/NetworkClient.cpp
+++ b/src/NetworkClient.cpp
@@ -5,7 +5,7 @@ NetworkClient::NetworkClient(std::string address, unsigned short port, std::stri
state = Handshaking;
PacketHandshake handshake;
- handshake.protocolVersion = 335;
+ handshake.protocolVersion = 338;
handshake.serverAddress = address;
handshake.serverPort = port;
handshake.nextState = 2;
@@ -17,6 +17,10 @@ NetworkClient::NetworkClient(std::string address, unsigned short port, std::stri
network.SendPacket(loginStart);
auto response = std::static_pointer_cast<PacketLoginSuccess>(network.ReceivePacket(Login));
+
+ while (!response)
+ response = std::static_pointer_cast<PacketLoginSuccess>(network.ReceivePacket(Login));
+
if (response->Username != username) {
throw std::logic_error("Received username is not sended username");
}