diff --git a/src/openrct2-ui/windows/TitleEditor.cpp b/src/openrct2-ui/windows/TitleEditor.cpp index 4815935462..fcb0018b22 100644 --- a/src/openrct2-ui/windows/TitleEditor.cpp +++ b/src/openrct2-ui/windows/TitleEditor.cpp @@ -345,12 +345,11 @@ static void window_title_editor_mouseup(rct_window* w, rct_widgetindex widgetInd { auto handle = TitleSequenceGetParkHandle(*_editingTitleSequence, w->selected_list_item); auto stream = static_cast(handle->Stream); - auto hintPath = String::ToStd(handle->HintPath); - bool isScenario = ParkImporter::ExtensionIsScenario(hintPath); + bool isScenario = ParkImporter::ExtensionIsScenario(handle->HintPath); try { auto& objectMgr = OpenRCT2::GetContext()->GetObjectManager(); - auto parkImporter = std::unique_ptr(ParkImporter::Create(hintPath)); + auto parkImporter = std::unique_ptr(ParkImporter::Create(handle->HintPath)); auto result = parkImporter->LoadFromStream(stream, isScenario); objectMgr.LoadObjects(result.RequiredObjects.data(), result.RequiredObjects.size()); parkImporter->Import(); diff --git a/src/openrct2/title/TitleSequence.cpp b/src/openrct2/title/TitleSequence.cpp index b26357b7d8..abe9dc119c 100644 --- a/src/openrct2/title/TitleSequence.cpp +++ b/src/openrct2/title/TitleSequence.cpp @@ -119,7 +119,7 @@ std::unique_ptr TitleSequenceGetParkHandle(TitleSequenc handle = std::make_unique(); handle->Stream = ms; - handle->HintPath = String::Duplicate(filename); + handle->HintPath = filename; } else { @@ -143,19 +143,13 @@ std::unique_ptr TitleSequenceGetParkHandle(TitleSequenc { handle = std::make_unique(); handle->Stream = fileStream; - handle->HintPath = String::Duplicate(filename); + handle->HintPath = filename; } } } return handle; } -void TitleSequenceCloseParkHandle(TitleSequenceParkHandle& handle) -{ - Memory::Free(handle.HintPath); - delete (static_cast(handle.Stream)); -} - bool TitleSequenceSave(TitleSequence& seq) { try diff --git a/src/openrct2/title/TitleSequence.h b/src/openrct2/title/TitleSequence.h index a256cadde1..a3f1e23934 100644 --- a/src/openrct2/title/TitleSequence.h +++ b/src/openrct2/title/TitleSequence.h @@ -53,7 +53,7 @@ struct TitleSequence struct TitleSequenceParkHandle { - const utf8* HintPath; + std::string HintPath; void* Stream; };