mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
New PROTOCOL_VERSION scheme (allow client to support a range of versions)
This commit is contained in:
parent
ab507f83e2
commit
197542c7ec
3 changed files with 32 additions and 13 deletions
|
@ -499,8 +499,9 @@ void Client::step(float dtime)
|
|||
// [2] u8 SER_FMT_VER_HIGHEST
|
||||
// [3] u8[20] player_name
|
||||
// [23] u8[28] password (new in some version)
|
||||
// [51] u16 client network protocol version (new in some version)
|
||||
SharedBuffer<u8> data(2+1+PLAYERNAME_SIZE+PASSWORD_SIZE+2);
|
||||
// [51] u16 minimum supported network protocol version (added sometime)
|
||||
// [53] u16 maximum supported network protocol version (added later than the previous one)
|
||||
SharedBuffer<u8> data(2+1+PLAYERNAME_SIZE+PASSWORD_SIZE+2+2);
|
||||
writeU16(&data[0], TOSERVER_INIT);
|
||||
writeU8(&data[2], SER_FMT_VER_HIGHEST);
|
||||
|
||||
|
@ -513,8 +514,8 @@ void Client::step(float dtime)
|
|||
memset((char*)&data[23], 0, PASSWORD_SIZE);
|
||||
snprintf((char*)&data[23], PASSWORD_SIZE, "%s", m_password.c_str());
|
||||
|
||||
// This should be incremented in each version
|
||||
writeU16(&data[51], PROTOCOL_VERSION);
|
||||
writeU16(&data[51], CLIENT_PROTOCOL_VERSION_MIN);
|
||||
writeU16(&data[53], CLIENT_PROTOCOL_VERSION_MAX);
|
||||
|
||||
// Send as unreliable
|
||||
Send(0, data, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue