Network is now working as udp or tcp. Next step is making the hybrid.
This commit is contained in:
@@ -37,7 +37,6 @@ void Packet::Init(MessageType type, unsigned int & packetID)
|
||||
// allocate memory for size of packet(only used in tcp)
|
||||
Packet::WritePrimitive<int>(0);
|
||||
// Add message type
|
||||
m_MessageType = type;
|
||||
int messageType = static_cast<int>(type);
|
||||
Packet::WritePrimitive<int>(messageType);
|
||||
Packet::WritePrimitive<int>(packetID);
|
||||
@@ -120,6 +119,13 @@ void Packet::ChangePacketID(unsigned int & packetID)
|
||||
memcpy(m_Data + 2*sizeof(int), &packetID, sizeof(int));
|
||||
}
|
||||
|
||||
MessageType Packet::GetMessageType()
|
||||
{
|
||||
MessageType messagType;
|
||||
memcpy(&messagType, m_Data + sizeof(int), sizeof(int));
|
||||
return messagType;
|
||||
}
|
||||
|
||||
void Packet::resizeData()
|
||||
{
|
||||
resizeData(m_MaxPacketSize * 2);
|
||||
|
||||
Reference in New Issue
Block a user