mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 13:33:02 +01:00
Use std::string for TitleSequenceParkHandle HintPath
Co-authored-by: Gabriel Guedes <gabriel.guedesaz@gmail.com>
This commit is contained in:
@@ -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<OpenRCT2::IStream*>(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<IParkImporter>(ParkImporter::Create(hintPath));
|
||||
auto parkImporter = std::unique_ptr<IParkImporter>(ParkImporter::Create(handle->HintPath));
|
||||
auto result = parkImporter->LoadFromStream(stream, isScenario);
|
||||
objectMgr.LoadObjects(result.RequiredObjects.data(), result.RequiredObjects.size());
|
||||
parkImporter->Import();
|
||||
|
||||
@@ -119,7 +119,7 @@ std::unique_ptr<TitleSequenceParkHandle> TitleSequenceGetParkHandle(TitleSequenc
|
||||
|
||||
handle = std::make_unique<TitleSequenceParkHandle>();
|
||||
handle->Stream = ms;
|
||||
handle->HintPath = String::Duplicate(filename);
|
||||
handle->HintPath = filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -143,19 +143,13 @@ std::unique_ptr<TitleSequenceParkHandle> TitleSequenceGetParkHandle(TitleSequenc
|
||||
{
|
||||
handle = std::make_unique<TitleSequenceParkHandle>();
|
||||
handle->Stream = fileStream;
|
||||
handle->HintPath = String::Duplicate(filename);
|
||||
handle->HintPath = filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
|
||||
void TitleSequenceCloseParkHandle(TitleSequenceParkHandle& handle)
|
||||
{
|
||||
Memory::Free(handle.HintPath);
|
||||
delete (static_cast<OpenRCT2::IStream*>(handle.Stream));
|
||||
}
|
||||
|
||||
bool TitleSequenceSave(TitleSequence& seq)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -53,7 +53,7 @@ struct TitleSequence
|
||||
|
||||
struct TitleSequenceParkHandle
|
||||
{
|
||||
const utf8* HintPath;
|
||||
std::string HintPath;
|
||||
void* Stream;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user