From cdb9f4cd18b23884145a6cca8207e91f70f561ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Wed, 4 Oct 2023 04:36:00 +0300 Subject: [PATCH] Fix #20843: Remove 0 padding from file path in scenario index filename --- src/openrct2/scenario/ScenarioRepository.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index b563c3ede3..63080a5c3f 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -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(item).Path = item.Path.substr(0, pos); + } + } ds << item.Timestamp; ds << item.Category; ds << item.SourceGame;