2012-01-29 14:28:19 -05:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
#include "cPacket_Login.h"
|
|
|
|
|
2012-01-29 14:28:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-20 12:39:16 -05:00
|
|
|
const std::string cPacket_Login::LEVEL_TYPE_DEFAULT = "DEFAULT";
|
|
|
|
const std::string cPacket_Login::LEVEL_TYPE_SUPERFLAT = "SUPERFLAT";
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cPacket_Login::Parse(const char * a_Data, int a_Size)
|
2011-10-03 14:41:19 -04:00
|
|
|
{
|
|
|
|
//printf("Parse: NEW Login\n");
|
2012-02-07 15:49:52 -05:00
|
|
|
int TotalBytes = 0;
|
2011-10-03 14:41:19 -04:00
|
|
|
m_Username.clear();
|
2012-02-07 15:49:52 -05:00
|
|
|
HANDLE_PACKET_READ(ReadInteger, m_ProtocolVersion, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadString16, m_Username, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadString16, m_LevelType, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadInteger, m_ServerMode, TotalBytes);
|
2012-03-01 12:07:41 -05:00
|
|
|
HANDLE_PACKET_READ(ReadInteger, m_Dimension, TotalBytes);
|
2012-02-07 15:49:52 -05:00
|
|
|
HANDLE_PACKET_READ(ReadByte, m_Difficulty, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadByte, m_WorldHeight, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadByte, m_MaxPlayers, TotalBytes);
|
|
|
|
return TotalBytes;
|
2011-10-03 14:41:19 -04:00
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cPacket_Login::Serialize(AString & a_Data) const
|
2011-10-03 14:41:19 -04:00
|
|
|
{
|
2012-02-07 15:49:52 -05:00
|
|
|
AppendByte (a_Data, m_PacketID);
|
|
|
|
AppendInteger (a_Data, m_ProtocolVersion);
|
|
|
|
AppendString16(a_Data, m_Username);
|
|
|
|
AppendString16(a_Data, m_LevelType);
|
|
|
|
AppendInteger (a_Data, m_ServerMode);
|
2012-03-01 12:07:41 -05:00
|
|
|
AppendInteger (a_Data, m_Dimension);
|
2012-02-07 15:49:52 -05:00
|
|
|
AppendByte (a_Data, m_Difficulty);
|
|
|
|
AppendByte (a_Data, m_WorldHeight);
|
|
|
|
AppendByte (a_Data, m_MaxPlayers);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|