Codechange: make md5sumToString std::string compatible

This commit is contained in:
Rubidium
2023-04-27 22:18:53 +02:00
committed by rubidium42
parent 51c6b8c1e4
commit a312a6c1b2
12 changed files with 24 additions and 54 deletions

View File

@@ -517,14 +517,11 @@ GRFListCompatibility IsGoodGRFConfigList(GRFConfig *grfconfig)
for (GRFConfig *c = grfconfig; c != nullptr; c = c->next) {
const GRFConfig *f = FindGRFConfig(c->ident.grfid, FGCM_EXACT, c->ident.md5sum);
if (f == nullptr || HasBit(f->flags, GCF_INVALID)) {
char buf[256];
/* If we have not found the exactly matching GRF try to find one with the
* same grfid, as it most likely is compatible */
f = FindGRFConfig(c->ident.grfid, FGCM_COMPATIBLE, nullptr, c->version);
if (f != nullptr) {
md5sumToString(buf, lastof(buf), c->ident.md5sum);
Debug(grf, 1, "NewGRF {:08X} ({}) not found; checksum {}. Compatibility mode on", BSWAP32(c->ident.grfid), c->filename, buf);
Debug(grf, 1, "NewGRF {:08X} ({}) not found; checksum {}. Compatibility mode on", BSWAP32(c->ident.grfid), c->filename, MD5SumToString(c->ident.md5sum));
if (!HasBit(c->flags, GCF_COMPATIBLE)) {
/* Preserve original_md5sum after it has been assigned */
SetBit(c->flags, GCF_COMPATIBLE);
@@ -537,8 +534,7 @@ GRFListCompatibility IsGoodGRFConfigList(GRFConfig *grfconfig)
}
/* No compatible grf was found, mark it as disabled */
md5sumToString(buf, lastof(buf), c->ident.md5sum);
Debug(grf, 0, "NewGRF {:08X} ({}) not found; checksum {}", BSWAP32(c->ident.grfid), c->filename, buf);
Debug(grf, 0, "NewGRF {:08X} ({}) not found; checksum {}", BSWAP32(c->ident.grfid), c->filename, MD5SumToString(c->ident.md5sum));
c->status = GCS_NOT_FOUND;
res = GLC_NOT_FOUND;