aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-07-05 21:05:07 +0200
committerLoïc Blot <lblot@infopro-digital.com>2015-07-07 17:03:26 +0200
commitd92d376148f7ed35df1c757aab5eca5645bb8ddd (patch)
treec019258eeb401fdfc1ec39413af9d07623f2bfcf /src/network
parenta93838707a9aab104c20b6a971d8c622184a508f (diff)
downloadminetest-d92d376148f7ed35df1c757aab5eca5645bb8ddd.tar.gz
minetest-d92d376148f7ed35df1c757aab5eca5645bb8ddd.tar.bz2
minetest-d92d376148f7ed35df1c757aab5eca5645bb8ddd.zip
Client: better m_proto_ver initialisation
Previously, m_proto_ver was set to the serialisation version inside the legacy init packet. Now, if the server doesn't send a protocol version (protocols < 25), we set m_proto_ver to some value < 25 and > 0.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/clientpackethandler.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index c0acff985..1ec6a2a1a 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -151,20 +151,23 @@ void Client::handleCommand_InitLegacy(NetworkPacket* pkt)
if (pkt->getSize() < 1)
return;
- u8 deployed;
- *pkt >> deployed;
+ u8 server_ser_ver;
+ *pkt >> server_ser_ver;
infostream << "Client: TOCLIENT_INIT_LEGACY received with "
- "deployed=" << ((int)deployed & 0xff) << std::endl;
+ "server_ser_ver=" << ((int)server_ser_ver & 0xff) << std::endl;
- if (!ser_ver_supported(deployed)) {
+ if (!ser_ver_supported(server_ser_ver)) {
infostream << "Client: TOCLIENT_INIT_LEGACY: Server sent "
<< "unsupported ser_fmt_ver"<< std::endl;
return;
}
- m_server_ser_ver = deployed;
- m_proto_ver = deployed;
+ m_server_ser_ver = server_ser_ver;
+
+ // We can be totally wrong with this guess
+ // but we only need some value < 25.
+ m_proto_ver = 24;
// Get player position
v3s16 playerpos_s16(0, BS * 2 + BS * 20, 0);