mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-26 16:24:35 +01:00
Fix: Title Sequence cannot load .park files
This commit is contained in:
@@ -23,24 +23,33 @@ namespace ParkImporter
|
||||
{
|
||||
std::unique_ptr<IParkImporter> parkImporter;
|
||||
std::string extension = Path::GetExtension(hintPath);
|
||||
if (ExtensionIsRCT1(extension))
|
||||
auto* context = OpenRCT2::GetContext();
|
||||
if (ExtensionIsOpenRCT2ParkFile(extension))
|
||||
{
|
||||
parkImporter = CreateParkFile(context->GetObjectRepository());
|
||||
}
|
||||
else if (ExtensionIsRCT1(extension))
|
||||
{
|
||||
parkImporter = CreateS4();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto context = OpenRCT2::GetContext();
|
||||
parkImporter = CreateS6(context->GetObjectRepository());
|
||||
}
|
||||
return parkImporter;
|
||||
}
|
||||
|
||||
bool ExtensionIsRCT1(const std::string& extension)
|
||||
bool ExtensionIsOpenRCT2ParkFile(std::string_view extension)
|
||||
{
|
||||
return String::Equals(extension, ".park", true);
|
||||
}
|
||||
|
||||
bool ExtensionIsRCT1(std::string_view extension)
|
||||
{
|
||||
return String::Equals(extension, ".sc4", true) || String::Equals(extension, ".sv4", true);
|
||||
}
|
||||
|
||||
bool ExtensionIsScenario(const std::string& extension)
|
||||
bool ExtensionIsScenario(std::string_view extension)
|
||||
{
|
||||
return String::Equals(extension, ".sc4", true) || String::Equals(extension, ".sc6", true)
|
||||
|| String::Equals(extension, ".sea", true);
|
||||
|
||||
@@ -64,8 +64,9 @@ namespace ParkImporter
|
||||
[[nodiscard]] std::unique_ptr<IParkImporter> CreateS6(IObjectRepository& objectRepository);
|
||||
[[nodiscard]] std::unique_ptr<IParkImporter> CreateParkFile(IObjectRepository& objectRepository);
|
||||
|
||||
bool ExtensionIsRCT1(const std::string& extension);
|
||||
bool ExtensionIsScenario(const std::string& extension);
|
||||
bool ExtensionIsOpenRCT2ParkFile(std::string_view extension);
|
||||
bool ExtensionIsRCT1(std::string_view extension);
|
||||
bool ExtensionIsScenario(std::string_view extension);
|
||||
} // namespace ParkImporter
|
||||
|
||||
class ObjectLoadException : public std::exception
|
||||
|
||||
Reference in New Issue
Block a user