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

Codechange: make the MD5 hash/digest/checksum variables a std::array

This commit is contained in:
Rubidium
2023-05-18 22:38:56 +02:00
committed by rubidium42
parent 7934418133
commit d9a04ba446
22 changed files with 91 additions and 83 deletions

View File

@@ -629,13 +629,12 @@ const char *FiosGetScreenshotDir()
/** Basic data to distinguish a scenario. Used in the server list window */
struct ScenarioIdentifier {
uint32 scenid; ///< ID for the scenario (generated by content).
uint8 md5sum[16]; ///< MD5 checksum of file.
MD5Hash md5sum; ///< MD5 checksum of file.
std::string filename; ///< filename of the file.
bool operator == (const ScenarioIdentifier &other) const
{
return this->scenid == other.scenid &&
memcmp(this->md5sum, other.md5sum, sizeof(this->md5sum)) == 0;
return this->scenid == other.scenid && this->md5sum == other.md5sum;
}
bool operator != (const ScenarioIdentifier &other) const
@@ -714,7 +713,7 @@ const char *FindScenario(const ContentInfo *ci, bool md5sum)
_scanner.Scan(false);
for (ScenarioIdentifier &id : _scanner) {
if (md5sum ? (memcmp(id.md5sum, ci->md5sum, sizeof(id.md5sum)) == 0)
if (md5sum ? (id.md5sum == ci->md5sum)
: (id.scenid == ci->unique_id)) {
return id.filename.c_str();
}