diff options
author | rubidium <rubidium@openttd.org> | 2007-01-30 17:12:46 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-30 17:12:46 +0000 |
commit | 291b7925ee2fd9b7e16a521a08a5dc6689668984 (patch) | |
tree | 8f9202452382a9c2e774f1d3cfdb93dfe45a6d85 /src/network/core/core.cpp | |
parent | 7feba09d9fba82c278df54f5cb1ff51229a8d62c (diff) | |
download | openttd-291b7925ee2fd9b7e16a521a08a5dc6689668984.tar.xz |
(svn r8459) -Codechange: move (Send|Recv)GRFIdentifier to NetworkSocketHandler, so it can also be used the TCP socket handler.
Diffstat (limited to 'src/network/core/core.cpp')
-rw-r--r-- | src/network/core/core.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/network/core/core.cpp b/src/network/core/core.cpp index 259ccf6c8..894529a05 100644 --- a/src/network/core/core.cpp +++ b/src/network/core/core.cpp @@ -5,6 +5,8 @@ #include "../../stdafx.h" #include "../../debug.h" #include "os_abstraction.h" +#include "core.h" +#include "packet.h" /** * @file core.cpp Functions used to initialize/shut down the core network @@ -88,4 +90,33 @@ void NetworkCoreShutdown(void) #endif } + +/** + * Serializes the GRFIdentifier (GRF ID and MD5 checksum) to the packet + * @param p the packet to write the data to + * @param grf the GRFIdentifier to serialize + */ +void NetworkSocketHandler::Send_GRFIdentifier(Packet *p, const GRFIdentifier *grf) +{ + uint j; + NetworkSend_uint32(p, grf->grfid); + for (j = 0; j < sizeof(grf->md5sum); j++) { + NetworkSend_uint8 (p, grf->md5sum[j]); + } +} + +/** + * Deserializes the GRFIdentifier (GRF ID and MD5 checksum) from the packet + * @param p the packet to read the data from + * @param grf the GRFIdentifier to deserialize + */ +void NetworkSocketHandler::Recv_GRFIdentifier(Packet *p, GRFIdentifier *grf) +{ + uint j; + grf->grfid = NetworkRecv_uint32(this, p); + for (j = 0; j < sizeof(grf->md5sum); j++) { + grf->md5sum[j] = NetworkRecv_uint8(this, p); + } +} + #endif /* ENABLE_NETWORK */ |