1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Merge pull request #16412

This commit is contained in:
Hielke Morsink
2022-01-10 16:04:25 +01:00
committed by GitHub
4 changed files with 18 additions and 7 deletions

View File

@@ -465,6 +465,7 @@ private:
News::InitQueue();
load_palette();
gScreenAge = 0;
gGamePaused = false;
gGameSpeed = 1;
}

View File

@@ -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);

View File

@@ -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

View File

@@ -309,7 +309,7 @@ static std::vector<std::string> GetSaves(IZipArchive* zip)
{
auto name = zip->GetFileName(i);
auto ext = Path::GetExtension(name);
if (String::Equals(ext, ".sv6", true) || String::Equals(ext, ".sc6", true))
if (String::Equals(ext, ".sv6", true) || String::Equals(ext, ".sc6", true) || String::Equals(ext, ".park", true))
{
saves.push_back(std::move(name));
}