1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 21:49:10 +00:00

(svn r20957) -Codechange: Add another parameter to FindGRFConfig() to define search restrictions.

This commit is contained in:
frosch
2010-10-17 12:12:13 +00:00
parent 918da8432a
commit 3972c790c2
9 changed files with 30 additions and 17 deletions

View File

@@ -690,7 +690,7 @@ DEF_GAME_RECEIVE_COMMAND(Client, PACKET_SERVER_CHECK_NEWGRFS)
this->Recv_GRFIdentifier(p, &c);
/* Check whether we know this GRF */
const GRFConfig *f = FindGRFConfig(c.grfid, c.md5sum);
const GRFConfig *f = FindGRFConfig(c.grfid, FGCM_EXACT, c.md5sum);
if (f == NULL) {
/* We do not know this GRF, bail out of initialization */
char buf[sizeof(c.md5sum) * 2 + 1];

View File

@@ -32,7 +32,7 @@ ClientNetworkContentSocketHandler _network_content_client;
/** Wrapper function for the HasProc */
static bool HasGRFConfig(const ContentInfo *ci, bool md5sum)
{
return FindGRFConfig(BSWAP32(ci->unique_id), md5sum ? ci->md5sum : NULL) != NULL;
return FindGRFConfig(BSWAP32(ci->unique_id), md5sum ? FGCM_EXACT : FGCM_ANY, md5sum ? ci->md5sum : NULL) != NULL;
}
/**

View File

@@ -176,7 +176,7 @@ void NetworkAfterNewGRFScan()
for (GRFConfig *c = item->info.grfconfig; c != NULL; c = c->next) {
assert(HasBit(c->flags, GCF_COPY));
const GRFConfig *f = FindGRFConfig(c->ident.grfid, c->ident.md5sum);
const GRFConfig *f = FindGRFConfig(c->ident.grfid, FGCM_EXACT, c->ident.md5sum);
if (f == NULL) {
/* Don't know the GRF, so mark game incompatible and the (possibly)
* already resolved name for this GRF (another server has sent the

View File

@@ -805,7 +805,7 @@ public:
for (GRFConfig *c = item->info.grfconfig; c != NULL; c = c->next) {
if (c->status != GCS_NOT_FOUND) continue;
const GRFConfig *f = FindGRFConfig(c->ident.grfid, c->ident.md5sum);
const GRFConfig *f = FindGRFConfig(c->ident.grfid, FGCM_EXACT, c->ident.md5sum);
if (f == NULL) {
missing_grfs = true;
continue;

View File

@@ -182,7 +182,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS)
this->Recv_GRFIdentifier(p, &c);
/* Find the matching GRF file */
f = FindGRFConfig(c.grfid, c.md5sum);
f = FindGRFConfig(c.grfid, FGCM_EXACT, c.md5sum);
if (f == NULL) continue; // The GRF is unknown to this server
/* If the reply might exceed the size of the packet, only reply
@@ -362,7 +362,7 @@ DEF_UDP_RECEIVE_COMMAND(Client, PACKET_UDP_SERVER_NEWGRFS)
void ClientNetworkUDPSocketHandler::HandleIncomingNetworkGameInfoGRFConfig(GRFConfig *config)
{
/* Find the matching GRF file */
const GRFConfig *f = FindGRFConfig(config->ident.grfid, config->ident.md5sum);
const GRFConfig *f = FindGRFConfig(config->ident.grfid, FGCM_EXACT, config->ident.md5sum);
if (f == NULL) {
/* Don't know the GRF, so mark game incompatible and the (possibly)
* already resolved name for this GRF (another server has sent the