File diff r25654:e264fd698eb2 → r25655:1030dcb7eb52
src/newgrf_config.cpp
Show inline comments
 
@@ -307,7 +307,7 @@ size_t GRFGetSizeOfDataSection(FILE *f)
 
			/* Valid container version 2, get data section size. */
 
			size_t offset = ((size_t)data[13] << 24) | ((size_t)data[12] << 16) | ((size_t)data[11] << 8) | (size_t)data[10];
 
			if (offset >= 1 * 1024 * 1024 * 1024) {
 
				DEBUG(grf, 0, "Unexpectedly large offset for NewGRF");
 
				Debug(grf, 0, "Unexpectedly large offset for NewGRF");
 
				/* Having more than 1 GiB of data is very implausible. Mostly because then
 
				 * all pools in OpenTTD are flooded already. Or it's just Action C all over.
 
				 * In any case, the offsets to graphics will likely not work either. */
 
@@ -524,7 +524,7 @@ GRFListCompatibility IsGoodGRFConfigList
 
			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 (%s) not found; checksum %s. 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, buf);
 
				if (!HasBit(c->flags, GCF_COMPATIBLE)) {
 
					/* Preserve original_md5sum after it has been assigned */
 
					SetBit(c->flags, GCF_COMPATIBLE);
 
@@ -538,13 +538,13 @@ GRFListCompatibility IsGoodGRFConfigList
 

	
 
			/* No compatible grf was found, mark it as disabled */
 
			md5sumToString(buf, lastof(buf), c->ident.md5sum);
 
			DEBUG(grf, 0, "NewGRF %08X (%s) not found; checksum %s", BSWAP32(c->ident.grfid), c->filename, buf);
 
			Debug(grf, 0, "NewGRF {:08X} ({}) not found; checksum {}", BSWAP32(c->ident.grfid), c->filename, buf);
 

	
 
			c->status = GCS_NOT_FOUND;
 
			res = GLC_NOT_FOUND;
 
		} else {
 
compatible_grf:
 
			DEBUG(grf, 1, "Loading GRF %08X from %s", BSWAP32(f->ident.grfid), f->filename);
 
			Debug(grf, 1, "Loading GRF {:08X} from {}", BSWAP32(f->ident.grfid), f->filename);
 
			/* The filename could be the filename as in the savegame. As we need
 
			 * to load the GRF here, we need the correct filename, so overwrite that
 
			 * in any case and set the name and info when it is not set already.
 
@@ -673,10 +673,10 @@ void DoScanNewGRFFiles(NewGRFScanCallbac
 
	ClearGRFConfigList(&_all_grfs);
 
	TarScanner::DoScan(TarScanner::NEWGRF);
 

	
 
	DEBUG(grf, 1, "Scanning for NewGRFs");
 
	Debug(grf, 1, "Scanning for NewGRFs");
 
	uint num = GRFFileScanner::DoScan();
 

	
 
	DEBUG(grf, 1, "Scan complete, found %d files", num);
 
	Debug(grf, 1, "Scan complete, found {} files", num);
 
	if (num != 0 && _all_grfs != nullptr) {
 
		/* Sort the linked list using quicksort.
 
		 * For that we first have to make an array, then sort and