1
0

- 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
This commit is contained in:
mtilden@gmail.com
2011-12-26 09:09:47 +00:00
parent e2acb45d19
commit c7fa610be3
15 changed files with 125 additions and 47 deletions

View File

@@ -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: