mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Make ScenarioIdentifier use std::string for the filename
parent
3a822fcd01
commit
397221b94a
|
@ -632,7 +632,7 @@ const char *FiosGetScreenshotDir()
|
||||||
struct ScenarioIdentifier {
|
struct ScenarioIdentifier {
|
||||||
uint32 scenid; ///< ID for the scenario (generated by content).
|
uint32 scenid; ///< ID for the scenario (generated by content).
|
||||||
uint8 md5sum[16]; ///< MD5 checksum of file.
|
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
|
bool operator == (const ScenarioIdentifier &other) const
|
||||||
{
|
{
|
||||||
|
@ -676,7 +676,7 @@ public:
|
||||||
int fret = fscanf(f, "%u", &id.scenid);
|
int fret = fscanf(f, "%u", &id.scenid);
|
||||||
FioFCloseFile(f);
|
FioFCloseFile(f);
|
||||||
if (fret != 1) return false;
|
if (fret != 1) return false;
|
||||||
strecpy(id.filename, filename.c_str(), lastof(id.filename));
|
id.filename = filename;
|
||||||
|
|
||||||
Md5 checksum;
|
Md5 checksum;
|
||||||
uint8 buffer[1024];
|
uint8 buffer[1024];
|
||||||
|
@ -718,7 +718,7 @@ const char *FindScenario(const ContentInfo *ci, bool md5sum)
|
||||||
for (ScenarioIdentifier &id : _scanner) {
|
for (ScenarioIdentifier &id : _scanner) {
|
||||||
if (md5sum ? (memcmp(id.md5sum, ci->md5sum, sizeof(id.md5sum)) == 0)
|
if (md5sum ? (memcmp(id.md5sum, ci->md5sum, sizeof(id.md5sum)) == 0)
|
||||||
: (id.scenid == ci->unique_id)) {
|
: (id.scenid == ci->unique_id)) {
|
||||||
return id.filename;
|
return id.filename.c_str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue