diff options
author | mtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-26 10:09:47 +0100 |
---|---|---|
committer | mtilden@gmail.com <mtilden@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-26 10:09:47 +0100 |
commit | c7fa610be3b6e072d3da4611f6de72390ebbf446 (patch) | |
tree | eaa1e1d08d9136c78228ec067f4d41b1d33ef320 /source/cClientHandle.cpp | |
parent | - Added timer to cPlayer PlayerListItem because sending the packets like minecraft does (every tick per player) is 20 pps per client to each client and was causing Kicks for having too high of a packet queue (diff) | |
download | cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.gz cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.bz2 cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.lz cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.xz cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.tar.zst cuberite-c7fa610be3b6e072d3da4611f6de72390ebbf446.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cClientHandle.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 00e81c416..1182e2e58 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -70,7 +70,6 @@ #ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
-#include <stdlib.h> // rand()
#endif
#define AddPistonDir( x, y, z, dir, amount ) switch(dir) { case 0: (y)-=(amount); break; case 1: (y)+=(amount); break;\
@@ -84,7 +83,7 @@ typedef std::list<cPacket*> PacketList; struct cClientHandle::sClientHandleState
{
sClientHandleState()
- : ProtocolVersion( 0 )
+ : ProtocolVersion( 22 )
, pReceiveThread( 0 )
, pSendThread( 0 )
, pAuthenticateThread( 0 )
@@ -458,6 +457,10 @@ void cClientHandle::HandlePacket( cPacket* a_Packet ) {
LOG("LOGIN %s", GetUsername() );
cPacket_Login* PacketData = reinterpret_cast<cPacket_Login*>(a_Packet);
+ if (PacketData->m_ProtocolVersion != m_pState->ProtocolVersion) {
+ Kick("Your client is outdated!");
+ return;
+ }
if( m_pState->Username.compare( PacketData->m_Username ) != 0 )
{
Kick("Login Username does not match Handshake username!");
@@ -1243,9 +1246,10 @@ void cClientHandle::Tick(float a_Dt) LoginResponse.m_ProtocolVersion = m_Player->GetUniqueID();
//LoginResponse.m_Username = "";
LoginResponse.m_ServerMode = m_Player->GetGameMode(); //set gamemode from player.
- LoginResponse.m_MapSeed = 0;
+ LoginResponse.m_MapSeed = cRoot::Get()->GetWorld()->GetWorldSeed();
LoginResponse.m_Dimension = 0;
LoginResponse.m_MaxPlayers = (unsigned char)cRoot::Get()->GetWorld()->GetMaxPlayers();
+ LoginResponse.m_Difficulty = 2;
Send( LoginResponse );
// Send Weather if raining:
|