1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00
Files
OpenRCT2/src/openrct2/ParkImporter.cpp
Aaron van Geffen 05e56517ab Adopt existing namespaces into OpenRCT2 namespace (#22368)
* Put all of TitleSequenceManager into the same namespace

* Move RideConstructionState into the OpenRCT2 namespace

* Adopt existing namespaces into OpenRCT2 namespace

This adds `using namespace OpenRCT2` to compilation units where appropriate,
as a means to get the codebase to compile until these units have been placed
in a namespace of their own.
2024-07-26 09:59:58 +02:00

57 lines
1.8 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "ParkImporter.h"
#include "Context.h"
#include "core/Path.hpp"
#include "core/String.hpp"
#include "object/ObjectManager.h"
#include "object/ObjectRepository.h"
#include <memory>
namespace OpenRCT2::ParkImporter
{
std::unique_ptr<IParkImporter> Create(const std::string& hintPath)
{
std::unique_ptr<IParkImporter> parkImporter;
std::string extension = Path::GetExtension(hintPath);
auto* context = OpenRCT2::GetContext();
if (ExtensionIsOpenRCT2ParkFile(extension))
{
parkImporter = CreateParkFile(context->GetObjectRepository());
}
else if (ExtensionIsRCT1(extension))
{
parkImporter = CreateS4();
}
else
{
parkImporter = CreateS6(context->GetObjectRepository());
}
return parkImporter;
}
bool ExtensionIsOpenRCT2ParkFile(std::string_view extension)
{
return String::IEquals(extension, ".park");
}
bool ExtensionIsRCT1(std::string_view extension)
{
return String::IEquals(extension, ".sc4") || String::IEquals(extension, ".sv4");
}
bool ExtensionIsScenario(std::string_view extension)
{
return String::IEquals(extension, ".sc4") || String::IEquals(extension, ".sc6") || String::IEquals(extension, ".sea");
}
} // namespace OpenRCT2::ParkImporter