|
@@ -435,54 +435,54 @@ char *FindUnknownGRFName(uint32 grfid, u
|
|
|
static UnknownGRF *unknown_grfs = NULL;
|
|
|
|
|
|
for (grf = unknown_grfs; grf != NULL; grf = grf->next) {
|
|
|
if (grf->grfid == grfid) {
|
|
|
if (memcmp(md5sum, grf->md5sum, sizeof(grf->md5sum)) == 0) return grf->name;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!create) return NULL;
|
|
|
|
|
|
grf = CallocT<UnknownGRF>(1);
|
|
|
grf->grfid = grfid;
|
|
|
grf->next = unknown_grfs;
|
|
|
strecpy(grf->name, UNKNOWN_GRF_NAME_PLACEHOLDER, lastof(grf->name));
|
|
|
memcpy(grf->md5sum, md5sum, sizeof(grf->md5sum));
|
|
|
|
|
|
unknown_grfs = grf;
|
|
|
return grf->name;
|
|
|
}
|
|
|
|
|
|
#endif /* ENABLE_NETWORK */
|
|
|
|
|
|
|
|
|
/* Retrieve a NewGRF from the current config by its grfid */
|
|
|
GRFConfig *GetGRFConfig(uint32 grfid)
|
|
|
GRFConfig *GetGRFConfig(uint32 grfid, uint32 mask)
|
|
|
{
|
|
|
GRFConfig *c;
|
|
|
|
|
|
for (c = _grfconfig; c != NULL; c = c->next) {
|
|
|
if (c->grfid == grfid) return c;
|
|
|
if ((c->grfid & mask) == (grfid & mask)) return c;
|
|
|
}
|
|
|
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
|
|
|
/* Build a space separated list of parameters, and terminate */
|
|
|
char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last)
|
|
|
{
|
|
|
uint i;
|
|
|
|
|
|
/* Return an empty string if there are no parameters */
|
|
|
if (c->num_params == 0) return strecpy(dst, "", last);
|
|
|
|
|
|
for (i = 0; i < c->num_params; i++) {
|
|
|
if (i > 0) dst = strecpy(dst, " ", last);
|
|
|
dst += seprintf(dst, last, "%d", c->param[i]);
|
|
|
}
|
|
|
return dst;
|
|
|
}
|
|
|
|
|
|
/** Base GRF ID for OpenTTD's base graphics GRFs. */
|
|
|
static const uint32 OPENTTD_GRAPHICS_BASE_GRF_ID = BSWAP32(0xFF4F5400);
|
|
|
|