mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-09 19:10:38 +00:00
Codechange: Make ScenarioIdentifier use std::string for the filename
This commit is contained in:
parent
3a822fcd01
commit
397221b94a
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user