Fix #20843: Remove 0 padding from file path in scenario index filename

This commit is contained in:
ζeh Matt 2023-10-04 04:36:00 +03:00
parent 39ecab4bd2
commit cdb9f4cd18
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 9 additions and 0 deletions

View File

@ -155,6 +155,15 @@ protected:
void Serialise(DataSerialiser& ds, const ScenarioIndexEntry& item) const override
{
ds << item.Path;
if (ds.IsLoading())
{
// Field used to be fixed size length, remove the 0 padding.
const auto pos = item.Path.find('\0');
if (pos != std::string::npos)
{
const_cast<ScenarioIndexEntry&>(item).Path = item.Path.substr(0, pos);
}
}
ds << item.Timestamp;
ds << item.Category;
ds << item.SourceGame;