Removed the split between 1.2.3 and 1.1, left only 1.2.3 code
git-svn-id: http://mc-server.googlecode.com/svn/trunk@429 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
b69ac328c0
commit
e1ef489e08
@ -42,7 +42,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../zlib-1.2.5;../jsoncpp-src-0.5.0/include;../lua-5.1.4/src;../tolua++-1.0.93/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;MINECRAFT_1_2_2=1"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
@ -178,11 +178,3 @@ public:
|
||||
|
||||
|
||||
|
||||
// TODO: Remove this when 1.2 is the major version out there and we're fully compatible
|
||||
#ifndef MINECRAFT_1_2_2
|
||||
#define MINECRAFT_1_2_2 (1)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -372,30 +372,17 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
|
||||
MultiBlock.m_ChunkX = m_PosX;
|
||||
MultiBlock.m_ChunkZ = m_PosZ;
|
||||
MultiBlock.m_NumBlocks = (short)PendingSendBlocks;
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
MultiBlock.m_Data = new cPacket_MultiBlock::sBlockChange[ PendingSendBlocks ];
|
||||
MultiBlock.m_DataSize = PendingSendBlocks * sizeof( cPacket_MultiBlock::sBlockChange );
|
||||
#else
|
||||
MultiBlock.m_BlockCoordinates = new unsigned short[PendingSendBlocks];
|
||||
MultiBlock.m_BlockTypes = new char[PendingSendBlocks];
|
||||
MultiBlock.m_BlockMetas = new char[PendingSendBlocks];
|
||||
#endif
|
||||
//LOG("Sending multiblock packet for %i blocks", PendingSendBlocks );
|
||||
for( unsigned int i = 0; i < PendingSendBlocks; i++)
|
||||
{
|
||||
unsigned int index = m_PendingSendBlocks[i];
|
||||
Vector3i BlockPos = IndexToCoordinate( index );
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
unsigned int Coords = BlockPos.y | (BlockPos.z << 8) | (BlockPos.x << 12);
|
||||
unsigned int Blocks = GetNibble( m_BlockMeta, index ) | (m_BlockTypes[index] << 4);
|
||||
MultiBlock.m_Data[i].Data = Coords << 16 | Blocks;
|
||||
#else
|
||||
MultiBlock.m_BlockCoordinates[i] = (BlockPos.z&0xf) | (BlockPos.x&0xf)<<4 | (BlockPos.y&0xff)<<8;
|
||||
//LOG("X: %i Y: %i Z: %i Combo: 0x%04x", X, Y, Z, MultiBlock.m_BlockCoordinates[i] );
|
||||
MultiBlock.m_BlockTypes[i] = m_BlockTypes[index];
|
||||
MultiBlock.m_BlockMetas[i] = GetNibble( m_BlockMeta, index );
|
||||
#endif
|
||||
}
|
||||
m_PendingSendBlocks.clear();
|
||||
PendingSendBlocks = m_PendingSendBlocks.size();
|
||||
|
@ -95,11 +95,7 @@ int cClientHandle::s_ClientCount = 0;
|
||||
|
||||
cClientHandle::cClientHandle(const cSocket & a_Socket, int a_ViewDistance)
|
||||
: m_ViewDistance(a_ViewDistance)
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
, m_ProtocolVersion(28)
|
||||
#else
|
||||
, m_ProtocolVersion(23)
|
||||
#endif
|
||||
, m_Socket(a_Socket)
|
||||
, m_bDestroyed(false)
|
||||
, m_Player(NULL)
|
||||
@ -302,9 +298,6 @@ void cClientHandle::Authenticate(void)
|
||||
LoginResponse.m_ProtocolVersion = m_Player->GetUniqueID();
|
||||
//LoginResponse.m_Username = "";
|
||||
LoginResponse.m_ServerMode = m_Player->GetGameMode(); // set gamemode from player.
|
||||
#if (MINECRAFT_1_2_2 != 1)
|
||||
LoginResponse.m_MapSeed = cRoot::Get()->GetWorld()->GetWorldSeed();
|
||||
#endif
|
||||
LoginResponse.m_Dimension = 0;
|
||||
LoginResponse.m_MaxPlayers = (unsigned char)cRoot::Get()->GetDefaultWorld()->GetMaxPlayers();
|
||||
LoginResponse.m_Difficulty = 2;
|
||||
@ -624,7 +617,6 @@ void cClientHandle::HandlePing(void)
|
||||
|
||||
void cClientHandle::HandleHandshake(cPacket_Handshake * a_Packet)
|
||||
{
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
AStringVector UserData = StringSplit( a_Packet->m_Username, ";" ); // "FakeTruth;localhost:25565"
|
||||
if( UserData.size() == 0 )
|
||||
{
|
||||
@ -632,9 +624,6 @@ void cClientHandle::HandleHandshake(cPacket_Handshake * a_Packet)
|
||||
return;
|
||||
}
|
||||
m_Username = UserData[0];
|
||||
#else
|
||||
m_Username = a_Packet->m_Username;
|
||||
#endif
|
||||
|
||||
LOG("HANDSHAKE %s", m_Username.c_str());
|
||||
|
||||
@ -1720,13 +1709,8 @@ void cClientHandle::Send(const cPacket & a_Packet, ENUM_PRIORITY a_Priority /* =
|
||||
// Check chunks being sent, erase them from m_ChunksToSend:
|
||||
if (a_Packet.m_PacketID == E_MAP_CHUNK)
|
||||
{
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
int ChunkX = ((cPacket_MapChunk &)a_Packet).m_PosX;
|
||||
int ChunkZ = ((cPacket_MapChunk &)a_Packet).m_PosZ;
|
||||
#else
|
||||
int ChunkX = ((cPacket_MapChunk &)a_Packet).m_PosX / cChunkDef::Width;
|
||||
int ChunkZ = ((cPacket_MapChunk &)a_Packet).m_PosZ / cChunkDef::Width;
|
||||
#endif
|
||||
bool Found = false;
|
||||
cCSLock Lock(m_CSChunkLists);
|
||||
for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr)
|
||||
|
@ -372,13 +372,6 @@ void cPlayer::Respawn()
|
||||
//Packet.m_CreativeMode = (char)GetWorld()->GetGameMode();
|
||||
Packet.m_CreativeMode = (char)m_GameMode; //Set GameMode packet based on Player's GameMode;
|
||||
|
||||
#if (MINECRAFT_1_2_2 != 1 )
|
||||
//TODO Less hardcoded
|
||||
Packet.m_World = 0;
|
||||
|
||||
Packet.m_MapSeed = GetWorld()->GetWorldSeed();
|
||||
#endif
|
||||
|
||||
//Send Packet
|
||||
m_ClientHandle->Send( Packet );
|
||||
|
||||
|
@ -21,16 +21,9 @@ int cPacket_Login::Parse(const char * a_Data, int a_Size)
|
||||
m_Username.clear();
|
||||
HANDLE_PACKET_READ(ReadInteger, m_ProtocolVersion, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadString16, m_Username, TotalBytes);
|
||||
#if (MINECRAFT_1_2_2 != 1 )
|
||||
HANDLE_PACKET_READ(ReadLong, m_MapSeed, TotalBytes);
|
||||
#endif
|
||||
HANDLE_PACKET_READ(ReadString16, m_LevelType, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadInteger, m_ServerMode, TotalBytes);
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
HANDLE_PACKET_READ(ReadInteger, m_Dimension, TotalBytes);
|
||||
#else
|
||||
HANDLE_PACKET_READ(ReadByte, m_Dimension, TotalBytes);
|
||||
#endif
|
||||
HANDLE_PACKET_READ(ReadByte, m_Difficulty, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadByte, m_WorldHeight, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadByte, m_MaxPlayers, TotalBytes);
|
||||
@ -46,16 +39,9 @@ void cPacket_Login::Serialize(AString & a_Data) const
|
||||
AppendByte (a_Data, m_PacketID);
|
||||
AppendInteger (a_Data, m_ProtocolVersion);
|
||||
AppendString16(a_Data, m_Username);
|
||||
#if (MINECRAFT_1_2_2 != 1 )
|
||||
AppendLong (a_Data, m_MapSeed);
|
||||
#endif
|
||||
AppendString16(a_Data, m_LevelType);
|
||||
AppendInteger (a_Data, m_ServerMode);
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
AppendInteger (a_Data, m_Dimension);
|
||||
#else
|
||||
AppendByte (a_Data, m_Dimension);
|
||||
#endif
|
||||
AppendByte (a_Data, m_Difficulty);
|
||||
AppendByte (a_Data, m_WorldHeight);
|
||||
AppendByte (a_Data, m_MaxPlayers);
|
||||
|
@ -12,9 +12,6 @@ class cPacket_Login : public cPacket //tolua_export
|
||||
public:
|
||||
cPacket_Login()
|
||||
: m_ProtocolVersion( 0 )
|
||||
#if (MINECRAFT_1_2_2 != 1)
|
||||
, m_MapSeed( 0 )
|
||||
#endif
|
||||
, m_ServerMode( 0 )
|
||||
, m_Dimension( 0 )
|
||||
, m_Difficulty( 0 )
|
||||
@ -27,29 +24,15 @@ public:
|
||||
virtual int Parse(const char * a_Data, int a_Size) override;
|
||||
virtual void Serialize(AString & a_Data) const override;
|
||||
|
||||
// 1.2.2 http://wiki.vg/Pre-release_protocol#Login_Request_.280x01.29
|
||||
int m_ProtocolVersion; //tolua_export
|
||||
AString m_Username; //tolua_export
|
||||
#if (MINECRAFT_1_2_2 != 1)
|
||||
long long m_MapSeed;
|
||||
#endif
|
||||
AString m_LevelType; //tolua_export
|
||||
int m_ServerMode; //tolua_export
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
int m_Dimension;
|
||||
#else
|
||||
char m_Dimension;
|
||||
#endif
|
||||
char m_Difficulty; //tolua_export
|
||||
unsigned char m_WorldHeight; //tolua_export
|
||||
unsigned char m_MaxPlayers; //tolua_export
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
static const unsigned int c_Size = 1 + 4 + 2 + 2 + 4 + 4 + 1 + 1 + 1;
|
||||
#else
|
||||
static const unsigned int c_Size = 1 + 4 + 2 + 8 + 2 + 4 + 1 + 1 + 1 + 1; // Minimal size
|
||||
#endif
|
||||
|
||||
static const AString LEVEL_TYPE_DEFAULT;
|
||||
static const AString LEVEL_TYPE_SUPERFLAT;
|
||||
}; //tolua_export
|
||||
|
@ -23,9 +23,6 @@ cPacket_MapChunk::cPacket_MapChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, con
|
||||
{
|
||||
m_PacketID = E_MAP_CHUNK;
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
|
||||
// ...
|
||||
m_PosX = a_ChunkX; // Chunk coordinates now, instead of block coordinates
|
||||
m_PosZ = a_ChunkZ;
|
||||
|
||||
@ -113,24 +110,6 @@ cPacket_MapChunk::cPacket_MapChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, con
|
||||
|
||||
m_CompressedData = CompressedBlockData;
|
||||
m_CompressedSize = CompressedSize;
|
||||
|
||||
#else
|
||||
m_PosX = a_ChunkX * cChunkDef::Width; // It has to be block coordinates
|
||||
m_PosY = (short)(a_ChunkY * cChunkDef::Height);
|
||||
m_PosZ = a_ChunkZ * cChunkDef::Width;
|
||||
|
||||
m_SizeX = 15;
|
||||
m_SizeY = 127;
|
||||
m_SizeZ = 15;
|
||||
|
||||
uLongf CompressedSize = compressBound( cChunkDef::BlockDataSize );
|
||||
char * CompressedBlockData = new char[CompressedSize];
|
||||
|
||||
compress2( (Bytef*)CompressedBlockData, &CompressedSize, (const Bytef*)a_BlockData, cChunkDef::BlockDataSize, Z_DEFAULT_COMPRESSION);
|
||||
|
||||
m_CompressedData = CompressedBlockData;
|
||||
m_CompressedSize = CompressedSize;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -141,7 +120,6 @@ cPacket_MapChunk::cPacket_MapChunk( const cPacket_MapChunk & a_Copy )
|
||||
{
|
||||
m_PacketID = E_MAP_CHUNK;
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
m_PosX = a_Copy.m_PosX;
|
||||
m_PosZ = a_Copy.m_PosZ;
|
||||
m_bContiguous = a_Copy.m_bContiguous;
|
||||
@ -151,18 +129,6 @@ cPacket_MapChunk::cPacket_MapChunk( const cPacket_MapChunk & a_Copy )
|
||||
m_CompressedSize = a_Copy.m_CompressedSize;
|
||||
m_CompressedData = new char[m_CompressedSize];
|
||||
memcpy( m_CompressedData, a_Copy.m_CompressedData, m_CompressedSize );
|
||||
#else
|
||||
m_PosX = a_Copy.m_PosX;
|
||||
m_PosY = a_Copy.m_PosY;
|
||||
m_PosZ = a_Copy.m_PosZ;
|
||||
m_SizeX = a_Copy.m_SizeX;
|
||||
m_SizeY = a_Copy.m_SizeY;
|
||||
m_SizeZ = a_Copy.m_SizeZ;
|
||||
|
||||
m_CompressedSize = a_Copy.m_CompressedSize;
|
||||
m_CompressedData = new char[m_CompressedSize];
|
||||
memcpy( m_CompressedData, a_Copy.m_CompressedData, m_CompressedSize );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -173,7 +139,6 @@ void cPacket_MapChunk::Serialize(AString & a_Data) const
|
||||
{
|
||||
AppendByte (a_Data, m_PacketID);
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
AppendInteger(a_Data, m_PosX);
|
||||
AppendInteger(a_Data, m_PosZ);
|
||||
AppendBool (a_Data, m_bContiguous);
|
||||
@ -182,16 +147,6 @@ void cPacket_MapChunk::Serialize(AString & a_Data) const
|
||||
AppendInteger(a_Data, m_CompressedSize);
|
||||
AppendInteger(a_Data, m_UnusedInt);
|
||||
AppendData (a_Data, m_CompressedData, m_CompressedSize);
|
||||
#else
|
||||
AppendInteger(a_Data, m_PosX);
|
||||
AppendShort (a_Data, m_PosY);
|
||||
AppendInteger(a_Data, m_PosZ);
|
||||
AppendByte (a_Data, m_SizeX);
|
||||
AppendByte (a_Data, m_SizeY);
|
||||
AppendByte (a_Data, m_SizeZ);
|
||||
AppendInteger(a_Data, m_CompressedSize);
|
||||
AppendData (a_Data, m_CompressedData, m_CompressedSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,7 +13,6 @@ class cPacket_MapChunk :
|
||||
{
|
||||
public:
|
||||
cPacket_MapChunk()
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
: m_PosX( 0 )
|
||||
, m_PosZ( 0 )
|
||||
, m_bContiguous( false )
|
||||
@ -21,17 +20,8 @@ public:
|
||||
, m_BitMap2( 0 )
|
||||
, m_CompressedSize( 0 )
|
||||
, m_UnusedInt( 0 )
|
||||
#else
|
||||
: m_PosX( 0 )
|
||||
, m_PosY( 0 )
|
||||
, m_PosZ( 0 )
|
||||
, m_SizeX( 0 )
|
||||
, m_SizeY( 0 )
|
||||
, m_SizeZ( 0 )
|
||||
, m_CompressedSize( 0 )
|
||||
#endif
|
||||
, m_CompressedData( 0 )
|
||||
{ m_PacketID = E_MAP_CHUNK; m_CompressedData = 0; }
|
||||
, m_CompressedData( NULL )
|
||||
{ m_PacketID = E_MAP_CHUNK; }
|
||||
|
||||
cPacket_MapChunk( const cPacket_MapChunk & a_Copy );
|
||||
cPacket_MapChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, const BLOCKTYPE * a_BlockData, const BIOMETYPE * a_BiomeData);
|
||||
@ -40,27 +30,13 @@ public:
|
||||
|
||||
virtual void Serialize(AString & a_Data) const override;
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1 )
|
||||
int m_PosX;
|
||||
int m_PosZ;
|
||||
bool m_bContiguous; // le fuck?
|
||||
bool m_bContiguous;
|
||||
short m_BitMap1;
|
||||
short m_BitMap2;
|
||||
int m_CompressedSize;
|
||||
int m_UnusedInt;
|
||||
static const unsigned int c_Size = 1 + 4 + 4 + 1 + 2 + 2 + 4 + 4;
|
||||
#else
|
||||
int m_PosX; // In block coordinates
|
||||
short m_PosY;
|
||||
int m_PosZ;
|
||||
char m_SizeX; // Is actually size-1 (when size is 128, this is 127)
|
||||
char m_SizeY;
|
||||
char m_SizeZ;
|
||||
int m_CompressedSize;
|
||||
static const unsigned int c_Size = 1 + 4 + 2 + 4 + 1 + 1 + 1 + 4;
|
||||
#endif
|
||||
|
||||
|
||||
char * m_CompressedData;
|
||||
};
|
||||
|
||||
|
@ -13,20 +13,9 @@ cPacket_MultiBlock::cPacket_MultiBlock( const cPacket_MultiBlock & a_Copy )
|
||||
m_ChunkX = a_Copy.m_ChunkX;
|
||||
m_ChunkZ = a_Copy.m_ChunkZ;
|
||||
m_NumBlocks = a_Copy.m_NumBlocks;
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
m_DataSize = a_Copy.m_DataSize;
|
||||
|
||||
m_Data = new sBlockChange[m_NumBlocks];
|
||||
memcpy( m_Data, a_Copy.m_Data, sizeof(sBlockChange)*m_NumBlocks );
|
||||
#else
|
||||
m_BlockCoordinates = new unsigned short[m_NumBlocks];
|
||||
memcpy( m_BlockCoordinates, a_Copy.m_BlockCoordinates, sizeof(short)*m_NumBlocks );
|
||||
m_BlockTypes = new char[m_NumBlocks];
|
||||
memcpy( m_BlockTypes, a_Copy.m_BlockTypes, m_NumBlocks );
|
||||
m_BlockMetas = new char[m_NumBlocks];
|
||||
memcpy( m_BlockMetas, a_Copy.m_BlockMetas, m_NumBlocks );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -35,13 +24,7 @@ cPacket_MultiBlock::cPacket_MultiBlock( const cPacket_MultiBlock & a_Copy )
|
||||
|
||||
cPacket_MultiBlock::~cPacket_MultiBlock()
|
||||
{
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
delete [] m_Data;
|
||||
#else
|
||||
if( m_BlockCoordinates ) delete [] m_BlockCoordinates;
|
||||
if( m_BlockTypes ) delete [] m_BlockTypes;
|
||||
if( m_BlockMetas ) delete [] m_BlockMetas;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -55,15 +38,11 @@ void cPacket_MultiBlock::Serialize(AString & a_Data) const
|
||||
AppendInteger(a_Data, m_ChunkZ);
|
||||
AppendShort (a_Data, m_NumBlocks);
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
AppendInteger(a_Data, m_DataSize);
|
||||
for( int i = 0; i < m_NumBlocks; ++i )
|
||||
{
|
||||
AppendInteger(a_Data, m_Data[i].Data);
|
||||
#else
|
||||
AppendData (a_Data, (char *)m_BlockCoordinates, sizeof(short) * m_NumBlocks);
|
||||
AppendData (a_Data, m_BlockTypes, m_NumBlocks);
|
||||
AppendData (a_Data, m_BlockMetas, m_NumBlocks);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,15 +24,10 @@ public:
|
||||
: m_ChunkX( 0 )
|
||||
, m_ChunkZ( 0 )
|
||||
, m_NumBlocks( 0 )
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
, m_DataSize( 0 )
|
||||
, m_Data( 0 )
|
||||
#else
|
||||
, m_BlockCoordinates( 0 )
|
||||
, m_BlockTypes( 0 )
|
||||
, m_BlockMetas( 0 )
|
||||
#endif
|
||||
, m_Data( NULL )
|
||||
{ m_PacketID = E_MULTI_BLOCK; }
|
||||
|
||||
cPacket_MultiBlock( const cPacket_MultiBlock & a_Copy );
|
||||
~cPacket_MultiBlock();
|
||||
virtual cPacket* Clone() const { return new cPacket_MultiBlock(*this); }
|
||||
@ -43,17 +38,8 @@ public:
|
||||
int m_ChunkZ;
|
||||
short m_NumBlocks;
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
int m_DataSize; // Should be 4 * m_NumBlocks ??
|
||||
sBlockChange * m_Data;
|
||||
static const unsigned int cSize = 1 + 4 + 4 + 2 + 4; // Minimum size (when NumBlocks == 0)
|
||||
#else
|
||||
static const unsigned int c_Size = 1 + 4 + 4 + 2; // Minimum size (when NumBlocks == 0)
|
||||
|
||||
unsigned short* m_BlockCoordinates; // x<<12 | z<<8 | y
|
||||
char* m_BlockTypes;
|
||||
char* m_BlockMetas;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -11,20 +11,11 @@ void cPacket_Respawn::Serialize(AString & a_Data) const
|
||||
{
|
||||
AppendByte (a_Data, m_PacketID);
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
AppendInteger (a_Data, m_Dimension);
|
||||
AppendByte (a_Data, m_Difficulty);
|
||||
AppendByte (a_Data, m_CreativeMode);
|
||||
AppendShort (a_Data, m_WorldHeight);
|
||||
AppendString16(a_Data, m_LevelType);
|
||||
#else
|
||||
AppendByte (a_Data, m_World);
|
||||
AppendByte (a_Data, m_Difficulty);
|
||||
AppendByte (a_Data, m_CreativeMode);
|
||||
AppendShort (a_Data, m_WorldHeight);
|
||||
AppendLong (a_Data, m_MapSeed);
|
||||
AppendString16(a_Data, m_LevelType);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -35,20 +26,11 @@ int cPacket_Respawn::Parse(const char * a_Data, int a_Size)
|
||||
{
|
||||
int TotalBytes = 0;
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
HANDLE_PACKET_READ(ReadInteger, m_Dimension, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadByte, m_Difficulty, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadByte, m_CreativeMode, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadShort, m_WorldHeight, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadString16, m_LevelType, TotalBytes);
|
||||
#else
|
||||
HANDLE_PACKET_READ(ReadByte, m_World, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadByte, m_Difficulty, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadByte, m_CreativeMode, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadShort, m_WorldHeight, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadLong, m_MapSeed, TotalBytes);
|
||||
HANDLE_PACKET_READ(ReadString16, m_LevelType, TotalBytes);
|
||||
#endif
|
||||
return TotalBytes;
|
||||
}
|
||||
|
||||
|
@ -13,42 +13,23 @@ class cPacket_Respawn : public cPacket
|
||||
{
|
||||
public:
|
||||
cPacket_Respawn()
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
: m_Dimension( 0 )
|
||||
, m_Difficulty( 0 )
|
||||
, m_CreativeMode( 0 )
|
||||
, m_WorldHeight( 0 )
|
||||
, m_LevelType( cPacket_Login::LEVEL_TYPE_DEFAULT )
|
||||
#else
|
||||
: m_World( 0 )
|
||||
, m_Difficulty( 0 )
|
||||
, m_CreativeMode( 0 )
|
||||
, m_WorldHeight( 0 )
|
||||
, m_MapSeed( 0 )
|
||||
, m_LevelType( cPacket_Login::LEVEL_TYPE_DEFAULT )
|
||||
#endif
|
||||
{ m_PacketID = E_RESPAWN; }
|
||||
|
||||
virtual cPacket* Clone() const { return new cPacket_Respawn( *this ); }
|
||||
|
||||
virtual int Parse(const char * a_Data, int a_Size) override;
|
||||
virtual void Serialize(AString & a_Data) const override;
|
||||
|
||||
#if (MINECRAFT_1_2_2 == 1)
|
||||
int m_Dimension;
|
||||
char m_Difficulty;
|
||||
char m_CreativeMode;
|
||||
short m_WorldHeight;
|
||||
AString m_LevelType;
|
||||
#else
|
||||
char m_World;
|
||||
char m_Difficulty;
|
||||
char m_CreativeMode;
|
||||
short m_WorldHeight;
|
||||
long long m_MapSeed;
|
||||
AString m_LevelType;
|
||||
#endif
|
||||
|
||||
static const unsigned int c_Size = 1 + 1 + 1 + 1 + 2 + 8 + 2;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user