(svn r8489) [0.5] -Backport from trunk (8459, 8461): check for NewGRF compatability before actually downloading the map from a game server when connecting from the command prompt and internal console.

This commit is contained in:
rubidium
2007-01-31 12:39:41 +00:00
parent 1ec915e1c8
commit 4e1c7b8197
7 changed files with 146 additions and 46 deletions
+30
View File
@@ -293,6 +293,36 @@ void NetworkRecv_string(NetworkClientState *cs, Packet *p, char *buffer, size_t
// (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;