1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "cPacket_Metadata.h"
cPacket_Metadata::cPacket_Metadata(int s, int id)
: m_EMetaData( (cPawn::MetaData)s )
, m_UniqueID( id )
, m_Type( 0 )
, m_MetaData( 0 )
{
m_PacketID = E_METADATA;
FormPacket();
}
cPacket_Metadata::cPacket_Metadata()
: m_UniqueID( 0 )
, m_Type( 0 )
, m_MetaData( 0 )
{
m_PacketID = E_METADATA;
m_EMetaData = cPawn::NORMAL;
FormPacket();
}
cPacket_Metadata::cPacket_Metadata(const cPacket_Metadata & a_Other)
: m_EMetaData( a_Other.m_EMetaData )
, m_UniqueID( a_Other.m_UniqueID )
, m_Type( a_Other.m_Type )
, m_MetaData( NULL )
{
m_PacketID = E_METADATA;
FormPacket();
}
cPacket_Metadata::~cPacket_Metadata()
{
delete [] m_MetaData;
}
void cPacket_Metadata::FormPacket()
{
delete [] m_MetaData;
m_MetaData = new char[3];
m_MetaDataSize = 3;
// m_UniqueID = GetUniqueID();
m_MetaData[0] = 0x00;
m_MetaData[2] = 0x7f;
switch(m_EMetaData)
{
case cPawn::NORMAL:
m_MetaData[1] = 0x00;
break;
case cPawn::BURNING:
m_MetaData[1] = 0x01;
break;
case cPawn::CROUCHED:
m_MetaData[1] = 0x02;
break;
case cPawn::RIDING:
m_MetaData[1] = 0x04;
break;
case cPawn::SPRINTING:
m_MetaData[1] = 0x08;
break;
case cPawn::EATING:
case cPawn::BLOCKING:
m_MetaData[1] = 0x10;
break;
default:
m_MetaData[1] = 0x00;
break;
}
}
void cPacket_Metadata::Serialize(AString & a_Data) const
{
AppendByte (a_Data, m_PacketID);
AppendInteger(a_Data, m_UniqueID);
AppendData (a_Data, m_MetaData, m_MetaDataSize);
}
|