/** * Find the GRFID of a given grf, and calculate its md5sum. * @param config grf to fill. * @param is_static grf is static. * @param subdir the subdirectory to search in. * @return Operation was successfully completed. */ bool FillGRFDetails(GRFConfig *config, bool is_static, Subdirectory subdir) { if (!FioCheckFileExists(config->filename, subdir)) { config->status = GCS_NOT_FOUND; return false; } /* Find and load the Action 8 information */ LoadNewGRFFile(config, CONFIG_SLOT, GLS_FILESCAN, subdir); config->SetSuitablePalette(); config->FinalizeParameterInfo(); /* Skip if the grfid is 0 (not read) or 0xFFFFFFFF (ttdp system grf) */ if (config->ident.grfid == 0 || config->ident.grfid == 0xFFFFFFFF || config->IsOpenTTDBaseGRF()) return false; if (is_static) { /* Perform a 'safety scan' for static GRFs */ LoadNewGRFFile(config, 62, GLS_SAFETYSCAN, subdir); /* GCF_UNSAFE is set if GLS_SAFETYSCAN finds unsafe actions */ if (HasBit(config->flags, GCF_UNSAFE)) return false; } return CalcGRFMD5Sum(config, subdir); }
/* Find the GRFID and calculate the md5sum */ bool FillGRFDetails(GRFConfig *config, bool is_static) { if (!FioCheckFileExists(config->filename)) { config->status = GCS_NOT_FOUND; return false; } /* Find and load the Action 8 information */ LoadNewGRFFile(config, CONFIG_SLOT, GLS_FILESCAN); /* Skip if the grfid is 0 (not read) or 0xFFFFFFFF (ttdp system grf) */ if (config->grfid == 0 || config->grfid == 0xFFFFFFFF || config->IsOpenTTDBaseGRF()) return false; if (is_static) { /* Perform a 'safety scan' for static GRFs */ LoadNewGRFFile(config, 62, GLS_SAFETYSCAN); /* GCF_UNSAFE is set if GLS_SAFETYSCAN finds unsafe actions */ if (HasBit(config->flags, GCF_UNSAFE)) return false; } config->windows_paletted = (_use_palette == PAL_WINDOWS); return CalcGRFMD5Sum(config); }