Codechange: Make ScenarioIdentifier use std::string for the filename

This commit is contained in:
Rubidium 2023-04-16 22:24:10 +02:00 committed by rubidium42
parent 3a822fcd01
commit 397221b94a

View File

@ -632,7 +632,7 @@ const char *FiosGetScreenshotDir()
struct ScenarioIdentifier {
uint32 scenid; ///< ID for the scenario (generated by content).
uint8 md5sum[16]; ///< MD5 checksum of file.
char filename[MAX_PATH]; ///< filename of the file.
std::string filename; ///< filename of the file.
bool operator == (const ScenarioIdentifier &other) const
{
@ -676,7 +676,7 @@ public:
int fret = fscanf(f, "%u", &id.scenid);
FioFCloseFile(f);
if (fret != 1) return false;
strecpy(id.filename, filename.c_str(), lastof(id.filename));
id.filename = filename;
Md5 checksum;
uint8 buffer[1024];
@ -718,7 +718,7 @@ const char *FindScenario(const ContentInfo *ci, bool md5sum)
for (ScenarioIdentifier &id : _scanner) {
if (md5sum ? (memcmp(id.md5sum, ci->md5sum, sizeof(id.md5sum)) == 0)
: (id.scenid == ci->unique_id)) {
return id.filename;
return id.filename.c_str();
}
}