Rearranged the SerialPacket and serialization code

The serialization code is now using macros to simplify each line, and to
prevent errors. It should be noted that, apart from the region content,
the serialization and deserialization code is essentially identical.
This commit is contained in:
Kayne Ruse
2014-04-25 23:50:19 +10:00
parent dabb7b3b2e
commit 235a05d006
3 changed files with 127 additions and 159 deletions
+2 -2
View File
@@ -27,10 +27,10 @@
/* NOTE: Keep the PACKET_BUFFER_SIZE up to date
* NOTE: REGION_CONTENT is currently the largest type of packet
* map content: REGION_WIDTH * REGION_HEIGHT * REGION_DEPTH * sizoeof(region::type_t)
* map format: sizeof(int) * 2
* map format: sizeof(int) * 3
* metadata: sizeof(metadata)
*/
#define PACKET_BUFFER_SIZE REGION_WIDTH * REGION_HEIGHT * REGION_DEPTH * sizeof(Region::type_t) + sizeof(int) * 2 + sizeof(SerialPacket::Metadata)
#define PACKET_BUFFER_SIZE REGION_WIDTH * REGION_HEIGHT * REGION_DEPTH * sizeof(Region::type_t) + sizeof(int) * 3 + sizeof(SerialPacket::Metadata)
void serialize(SerialPacket* const, void*);
void deserialize(SerialPacket* const, void*);