From c7fa610be3b6e072d3da4611f6de72390ebbf446 Mon Sep 17 00:00:00 2001 From: "mtilden@gmail.com" Date: Mon, 26 Dec 2011 09:09:47 +0000 Subject: - Linux compatible fixes including updated makefile - Mersenne Twister still says uint32 but it's now signed for compatibility with random uses needing negative values - Server seed is sent to clients, but needs to be able to be signed long long later on for authentic reasons - Protocol Version is required to match to ensure client compatibility, this should probably have a settings.ini check as well as store the value there git-svn-id: http://mc-server.googlecode.com/svn/trunk@121 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/cClientHandle.cpp') 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 // 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 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(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: -- cgit v1.2.3