network_data.c
branch0.5
changeset 5424 f09762e44457
parent 4880 0708f34e3586
child 5510 d4b8e7933d5e
--- a/network_data.c	Thu Jan 18 00:52:33 2007 +0000
+++ b/network_data.c	Wed Jan 31 12:39:41 2007 +0000
@@ -293,6 +293,36 @@
 // (the line: 'p->size = (uint16)p->buffer[0];' and below)
 assert_compile(sizeof(PacketSize) == 2);
 
+
+/**
+ * Serializes the GRFIdentifier (GRF ID and MD5 checksum) to the packet
+ * @param p the packet to write the data to
+ * @param c the configuration to write the GRF ID and MD5 checksum from
+ */
+void NetworkSend_GRFIdentifier(Packet *p, const GRFConfig *c)
+{
+	uint j;
+	NetworkSend_uint32(p, c->grfid);
+	for (j = 0; j < sizeof(c->md5sum); j++) {
+		NetworkSend_uint8 (p, c->md5sum[j]);
+	}
+}
+
+/**
+ * Deserializes the GRFIdentifier (GRF ID and MD5 checksum) from the packet
+ * @param p the packet to read the data from
+ * @param c the configuration to write the GRF ID and MD5 checksum to
+ */
+void NetworkRecv_GRFIdentifier(NetworkClientState *cs, Packet *p, GRFConfig *c)
+{
+	uint j;
+	c->grfid = NetworkRecv_uint32(cs, p);
+	for (j = 0; j < sizeof(c->md5sum); j++) {
+		c->md5sum[j] = NetworkRecv_uint8(cs, p);
+	}
+}
+
+
 Packet *NetworkRecv_Packet(NetworkClientState *cs, NetworkRecvStatus *status)
 {
 	ssize_t res;