Use std::string for TitleSequence names

Co-authored-by: Gabriel Guedes <gabriel.guedesaz@gmail.com>
This commit is contained in:
Matt 2020-09-28 16:50:11 +03:00
parent 612249bd74
commit f586981cd3
No known key found for this signature in database
GPG Key ID: 6D4C24A61C93E208
4 changed files with 6 additions and 7 deletions

View File

@ -159,7 +159,7 @@ public:
{
if (!SkipToNextLoadCommand() || _position == entryPosition)
{
Console::Error::WriteLine("Unable to load any parks from %s.", _sequence->Name);
Console::Error::WriteLine("Unable to load any parks from %s.", _sequence->Name.c_str());
return false;
}
}

View File

@ -1,4 +1,4 @@
/*****************************************************************************
/*****************************************************************************
* Copyright (c) 2014-2020 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
@ -89,7 +89,7 @@ std::unique_ptr<TitleSequence> LoadTitleSequence(const utf8* path)
auto commands = LegacyScriptRead(reinterpret_cast<utf8*>(script.data()), script.size(), saves);
auto seq = CreateTitleSequence();
seq->Name = Path::GetFileNameWithoutExtension(path);
seq->Name = Path::GetFileNameWithoutExtension(std::string(path));
seq->Path = String::Duplicate(path);
for (auto* save : saves)
{
@ -102,7 +102,6 @@ std::unique_ptr<TitleSequence> LoadTitleSequence(const utf8* path)
void FreeTitleSequence(TitleSequence& seq)
{
Memory::Free(seq.Name);
Memory::Free(seq.Path);
}
@ -527,7 +526,7 @@ static std::string LegacyScriptWrite(const TitleSequence& seq)
auto sb = StringBuilder(128);
sb.Append("# SCRIPT FOR ");
sb.Append(seq.Name);
sb.Append(seq.Name.c_str());
sb.Append("\n");
for (const auto& command : seq.Commands)
{

View File

@ -42,7 +42,7 @@ struct TitleCommand
struct TitleSequence
{
const utf8* Name = nullptr;
std::string Name;
const utf8* Path = nullptr;
std::vector<TitleCommand> Commands;

View File

@ -139,7 +139,7 @@ namespace TitleSequenceManager
{
std::string path = GetNewTitleSequencePath(std::string(name), true);
auto seq = CreateTitleSequence();
seq->Name = String::Duplicate(name);
seq->Name = name;
seq->Path = String::Duplicate(path.c_str());
seq->IsZip = true;