More refucktoring.
This commit is contained in:
parent
0238803c8a
commit
5ae7728a2d
4 changed files with 14 additions and 14 deletions
|
@ -4,7 +4,7 @@ using namespace umcs;
|
|||
#include "config.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "packets/X02Handshake.h"
|
||||
#include "packets/C2S02Handshake.h"
|
||||
#include "utf.h"
|
||||
|
||||
CClientConnection::CClientConnection(TSocket Socket)
|
||||
|
@ -49,7 +49,7 @@ int CClientConnection::Communicate(void)
|
|||
LOG("Error: Unexpected packet ID %i on CONNECT state.\n", PacketID);
|
||||
return -1;
|
||||
}
|
||||
m_CurrentPacket = new X02Handshake(m_Buffer + 1);
|
||||
m_CurrentPacket = new C2S02Handshake(m_Buffer + 1);
|
||||
m_InPacket = true;
|
||||
}
|
||||
}
|
||||
|
@ -67,18 +67,18 @@ int CClientConnection::Communicate(void)
|
|||
// HANDSHAKE
|
||||
case 2:
|
||||
{
|
||||
LOG("Got handshake for protocol version %i\n", ((X02Handshake *)m_CurrentPacket)->GetProtocolVersion());
|
||||
if (((X02Handshake *)m_CurrentPacket)->GetProtocolVersion() != 49)
|
||||
LOG("Got handshake for protocol version %i\n", ((C2S02Handshake *)m_CurrentPacket)->GetProtocolVersion());
|
||||
if (((C2S02Handshake *)m_CurrentPacket)->GetProtocolVersion() != 49)
|
||||
{
|
||||
LOG("... that's not a version we support.\n", 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char Temp[256];
|
||||
UTF16ToASCIIDumb(((X02Handshake *)m_CurrentPacket)->GetUsername(), Temp);
|
||||
UTF16ToASCIIDumb(((C2S02Handshake *)m_CurrentPacket)->GetUsername(), Temp);
|
||||
LOG(" Username: %s\n", Temp);
|
||||
|
||||
m_Client = new CClient(((X02Handshake *)m_CurrentPacket)->GetUsername());
|
||||
m_Client = new CClient(((C2S02Handshake *)m_CurrentPacket)->GetUsername());
|
||||
m_State = HANDSHAKE;
|
||||
m_InPacket = false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CXXFLAGS="-std=c++0x"
|
||||
|
||||
all: ServerLoop.o ClientConnection.o main.o utf.o Client.o packets/GenericC2SPacket.o packets/X02Handshake.o
|
||||
g++ -o umcs ServerLoop.o ClientConnection.o main.o utf.o Client.o packets/GenericC2SPacket.o packets/X02Handshake.o
|
||||
all: ServerLoop.o ClientConnection.o main.o utf.o Client.o packets/GenericC2SPacket.o packets/C2S02Handshake.o
|
||||
g++ -o umcs ServerLoop.o ClientConnection.o main.o utf.o Client.o packets/GenericC2SPacket.o packets/C2S02Handshake.o
|
||||
|
||||
clean:
|
||||
rm umcs *.o packets/*.o 2>/dev/null || true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "X02Handshake.h"
|
||||
#include "C2S02Handshake.h"
|
||||
using namespace umcs;
|
||||
|
||||
bool X02Handshake::ReadField(unsigned int Field)
|
||||
bool C2S02Handshake::ReadField(unsigned int Field)
|
||||
{
|
||||
switch (Field)
|
||||
{
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef __X02_HANDSHAKE_H__
|
||||
#define __X02_HANDSHAKE_H__
|
||||
#ifndef __C2S02_HANDSHAKE_H__
|
||||
#define __C2S02_HANDSHAKE_H__
|
||||
|
||||
#include "GenericC2SPacket.h"
|
||||
|
||||
namespace umcs {
|
||||
class X02Handshake : public CGenericC2SPacket {
|
||||
class C2S02Handshake : public CGenericC2SPacket {
|
||||
private:
|
||||
char m_ProtocolVersion;
|
||||
unsigned short *m_Username;
|
||||
|
@ -14,7 +14,7 @@ namespace umcs {
|
|||
unsigned int GetNumFields(void) { return 4; };
|
||||
bool ReadField(unsigned int Field);
|
||||
public:
|
||||
X02Handshake(unsigned char *Buffer) : CGenericC2SPacket(Buffer) { }
|
||||
C2S02Handshake(unsigned char *Buffer) : CGenericC2SPacket(Buffer) { }
|
||||
virtual int GetPacketID(void) { return 2; }
|
||||
|
||||
char GetProtocolVersion(void) { return m_ProtocolVersion; }
|
Reference in a new issue