Reliable message should now be working, further testing is to be done.

This commit is contained in:
Jocke
2016-02-10 16:16:56 +01:00
parent 2ec30fd2b2
commit 4f2ad3ad00
9 changed files with 160 additions and 113 deletions
+4 -3
View File
@@ -35,11 +35,11 @@ void Packet::Init(MessageType type, unsigned int & packetID)
m_Offset = 0;
// Create message header
// allocate memory for size of packet(only used in tcp)
Packet::WritePrimitive<int>(0);
WritePrimitive<int>(0);
// Add message type
int messageType = static_cast<int>(type);
Packet::WritePrimitive<int>(messageType);
Packet::WritePrimitive<int>(packetID);
WritePrimitive<int>(messageType);
WritePrimitive<int>(packetID);
packetID++;
m_HeaderSize = m_Offset;
}
@@ -98,6 +98,7 @@ void Packet::ReconstructFromData(char * data, int sizeOfData)
void Packet::UpdateSize()
{
int whatisoffset = m_Offset;
memcpy(m_Data, &m_Offset, sizeof(int));
}